Choosing a File Type

Compare can print tables in spreadsheets, word processor files, or as plain text files. Some formatting commands are unique to a particular file type. Enter one of the following commands near the top of a stub file to instruct Compare on what type of file to create. If a file type is not specified, Compare will create an output file with special codes that are interpreted by the printer.

Printer Format

The default file type is printer format. These files should be sent directly to a printer. As an example, consider the following batch file that will send a file to an HP Laserjet 4200 printer from the windows command line:

@echo off
if "%1"=="" goto noarg
echo put %1 port1 > c:\temp\hpscript.bat
echo bye >> c:\temp\hpscript.bat
ftp -A -s:c:\temp\hpscript.bat <insert printer IP address here>
del c:\temp\hpscript.bat
goto end
:noarg
cls
echo :---------------------------------------------:
echo : php4200.bat:  print utility for text files. :
echo : usage:  php4200 [file]                      :
echo :---------------------------------------------:
echo :---------------------------------------------:
:end

If no argument is provided, then the batch file will print the required syntax. Otherwise, the filename of the Compare output file should be included. For example, if the batch file is named PHP4200.BAT and the Compare output file is TABLES.OUT, then the following should be entered into the Windows command prompt:

C:> PHP4200.BAT TABLES.OUT

For use with other printers, such as Brother models, first change the printer default setting to HP mode (where available). Next, download and install the prfile32.exe program from http://www.lerup.com/printfile. Launch the program and change Text File Settings | Text File Action to Send To Printer. Then from the command line, the command

“C:\Program Files\PrintFile\prfile32.exe” <filename>

will bring up a GUI. (You can put this on the path, either in a batch file that will set the path and print the file or as a default.) Select the desired printer and proceed.

See the printer control commands for details on the direct control of a printer.

\xls

This option makes all output go to a Microsoft Excel spreadsheet file. The default file extension and file type is .XLS, though other options are available. The Microsoft Excel program must be installed for this feature to work. Supported versions include Excel 2000, 2003, and 2007. Unlike the following \wk1 feature, printing to multiple worksheets is supported, with new sheets created as with new pages for other formats. See the \wstitle command for specifying worksheet names. Special formatting commands for Excel spreadsheets are presented in the “Formatting Commands for Excel Documents” section.

\wk1

This option makes all output go directly to a Lotus .WK1 file. Note that no matter what you give for the name of the output file, it will have the file extension .WK1. You still are limited to the maximum rows and columns (4096 x 256) when using a .WK1 file. To create larger spreadsheets and modern formats, use the \xls option.

\prn <y|n>

This option sets printing to a .PRN file, where all text will be in quotes. A .PRN file can be opened by any text editor or Microsoft Excel.

\rtf

This command will instruct Compare to create a Rich Text Format (.RTF) file. This file type can be opened with Microsoft Word, OpenOffice Writer, and most other document editing programs. Support for this file type is limited.

\gdata [<ObsPerLine>]

This command is used to generate output as a G7 “data card” file. For all series names or expressions in the file, output is written in a format usable as input for G7. The optional parameter <ObsPerLine> specifies how many observations will be written on each line. Note that the \field and \decs commands will determine the field width and number of decimal points to be printed. By default, series will be printed to G7 data cards at 5 observations per line, using the current field width and precision. Also, titles, subtitles, and comment lines (with a ‘;’ and text, but no series) will be printed to the file as G7-style comments (i.e., lines starting with a ‘#’). If you want to shorten the file and include only data cards, use the \nocomment option. Note that series that entirely are zeroes will not be printed.

\oneperline

This is a command like \gdata that is used to specify that output is not to be a table but rather a data dump. This command prints series to the output file with one data observation per line, with whatever is specified on the title field to the left of the data. Formatting is controlled by current width, precision, and line title width settings. Often this command could be used to print the data with series codes in the line title, with the codes passed as arguments to \fadd commands.