Chapter Contents |
Previous |
Next |
SAS Companion for UNIX Environments |
Using the PRINT Command with Forms |
To route the contents of a window to a printer that is not your default printer, you can use select a different form through the pull-down menu:
File | Print Utilities | Set Form Name... |
Note: Multiple forms can be specified for the same printer.
Select a form that uses a printer other than your default printer.
You can also select a different form by specifying the FORM= option with the PRINT command. For example, to copy output to a printer destination that is described in a form named MYOUTPUT, you enter the following command-line command:
print form=myoutput
For more information on forms, see Defining Forms.
Using PRTFILE and PRINT with a Fileref |
PRTFILE establishes the destination, and PRINT sends the contents of the window to that destination. If you do not specify a destination with the PRTFILE command, PRINT automatically sends the window contents to your default printer.
If you want to send output directly to a printer, you must first submit the FILENAME statement to assign a fileref to a PRINTER, XPRINTER, or PIPE device. For example, to print the contents of your OUTPUT window:
For example, the following statement associates MYRPT with the system printer named BLDGA2 and specifies two copies of every printout:
filename myrpt printer 'bldga2 -n2';(See the documentation for your print command for information about other options that you can specify.)
The following statement allows you to print output using
the
lp
command on the printer
named myljet:
filename ascout pipe 'lp -dmyljet';
The following statement sends output to the
lp
command and redirects any error messages produced
by this command to the
lperror
file in your home directory:
filename myrpt pipe 'lp 2>$HOME/lperror';
Note: Redirecting standard error is allowed only in
the Bourne and Korn shells.
The following statement associates MYRPT with your default host printer device:
filename myrpt xprinter;MYRPT can be defined as an external file or as a Postscript (or PCL) printer. You cannot specify options with the XPRINTER device, and you can open only one XPRINTER device at a time during a SAS session.
If you frequently use the same print command and destination, you can add the appropriate FILENAME statement to your autoexec file. See Customizing Your SAS Session for more information.
prtfile myrpt
A
in the requestor window to append the window contents
to the destination file.
Note: If you are using host
printing to send output to a file, the file will always be replaced; APPEND
is not valid for an XPRINTER device.
filename myrpt clear;
To return to forms-based printing, issue the PRTFILE CLEAR command.
Using the FILE Command |
You can use the FILE command to copy the contents of many different windows
to external files. Issue the FILE command on the command line of the window
whose contents you want to copy. For example, to copy the contents of the
LOG window to
/u/myid/log/app1
,
issue the following command on the command line of the LOG window:
file '/u/myid/log/app1'
If the file does not exist, SAS creates it. If the file already exists, a requestor window asks you whether you want to replace it or to append data to the existing data.
If you have already associated a fileref with your external file, you can use the fileref instead of the filename:
file myref
PRINT FILE=fileref | 'pathname' |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.