Writing ASCII Data From G7ΒΆ

Here are some G7 commands commonly used for writing data to ASCII output files. These complement specialized routines for printing data in other formats, such as Excel spreadsheets.

tdates <date1> <date2>
Sets the dates for subsequent typing commands without actually printing out any data.
(ty)pe <series_name> [<date1>] [<date2>]
(ty)pe (<expression>) [<date1>] [date2>]
Displays values for the named series from <date1> to <date2> on the screen. The values either may be a data series or an expression. If a legal expression is presented between parentheses, then the value is calculated and displayed. The first number on each line is the date of the first observation on the line. Dates may be omitted if they are unchanged from the previous type command. If the save command (see below) is on, the displayed values are transferred to the save file where they are preceeded with an (up)date command.
(sty)pe <series_name> [date1] [date2]
“Silent” type writes the series to the currently open “save file” without displaying data on the screen. This can speed processing a long add file.
matty [file <filename>] [<date1> [<date2>]] [<dump>]
<var1> [var2] ... [var100]
The command’s name abbreviates “matrix type.” It displays time series data for up to 100 variables ( var1, var2, ...) in vertical columns, with time running down the page. Data are shown for the range of dates specified by the preceding tdates commands.

For example, with the Quip data base assigned, the commands

tdates 1990.1 1991.4
matty gdp c v fe fi g

shows the results:

Date          gdp          c          v         fe         fi          g
1990.100      5660.6     3759.2      822.7      541.6      615.9     1153.0
1990.200      5750.8     3811.8      835.0      554.8      615.1     1164.3
1990.300      5782.2     3879.2      804.7      555.5      634.1     1176.9
1990.400      5781.7     3907.0      736.3      577.3      649.2     1210.4
1991.100      5821.9     3910.7      723.5      577.4      610.3     1220.6
1991.200      5892.5     3961.0      716.4      602.7      615.0     1227.4
1991.300      5950.2     4001.6      744.1      602.6      624.5     1226.5
1991.400      6002.1     4027.1      760.7      624.4      639.3     1229.2

If the first word after the command is “file”, then the next word is the name of a file to which the results will also be written. Example:

matty file nipa.dat gdp 1 c 2 cd  v 1 vfnre 2 vfnrs

The results are shown on the blue Results screen. If saving is on (as a result of a “save <filename>” command explained below), the results also go into the save file. If the optional “dump” keyword is provided, then the output is more compact; this is useful for creating spreadsheet-like text files.

gridty [file <filename>] [<date1> [<date2>]] <var1> [var2] ... [var100]
The grid display presents data in a spreadsheet window. This is convenient for scrolling about to look at the data. One can also copy data from the grid display to the Windows clipboard. This feature is very similar to the show command for displaying vectors and matrices; see that documentation for more details.
save <filename> [<type>]
save off
Opens a file of the given name to receive output produced by type, stype, matty, regression, and other commands. Most commands executed by G7 are stored in the “save” file. A save file is closed and saving terminated with the “off” option.
The optional <type> argument is the command that will be printed when using ty or sty commands. The default is “update”, but it may also be “data”, “vdata”, “ovr”, “ind”, “cta”, “gro”, “vupdate”, or “dump”.
ic [<text>]
The “InterDyme Comment” routine prints text to the G7 output window. If “save” is on, then the text is stored in the text file. In the file, a “#” is inserted before the string is printed. These lines are recognized by G7, Build, and IdBuild as comments.
text [<text>]
The text command nearly is identical to the ic command. It prints text to the G7 output window. If save is on, then the text is stored in the text file. In contrast to the ic command, no “#” is inserted before the string is printed.
The “time stamp” command prints the time and date to the G7 output window. If save is on, then the time and date is stored in the text file as a comment.
format <width> [<decs> [<obsPerLine>]]
format off
This command is used to override the default settings of the ty and sty commands for the width of the data, the number of decimal points, and the number of observations printed on each line. The <width> and <decs> arguments also apply to the matty or matpr command. If you give the “format off” command, it will return G7 to its default style of formatting. Without using this command, G7 decides on the format to use based on the absolute value of selected elements of the series. This can sometimes result in a messy .SAV file if all data is printed at different widths and decimal points.

Previous topic

Reading Data Into G7

Next topic

How To Read and Write in Excel Format with G7

This Page