Chapter Contents |
Previous |
Next |
SAS Companion for the OS/2 Environment |
This section provides examples of the most common methods of routing SAS procedure output and the SAS log to a file. Generally, this task is the same across operating environments and is discussed in the SAS System Help. However, the specification of external filenames and devices is system dependent. See Referencing External Files for complete information about the various ways to reference external files.
You can route your SAS procedure output or the SAS log to a file in one of several ways. The method that you choose depends on the method that you use to run the SAS System, the moment at which you make your decision to route the output or SAS log, and your personal preference.
Some methods of sending SAS procedure output or the SAS log to a file include using
Using the Save As Dialog Box |
The easiest way to save the contents of the active window to a file is to select
File | Save As |
Using the PRINTTO Procedure |
filename myoutput 'c:\sas\first.txt'; proc printto print=myoutput; run;
Any PROC or DATA statements that follow these statements and that generate output send their output to the C:\SAS\FIRST.TXT file, not to the default procedure output file. If you want to return to the default file, issue an empty PROC PRINTTO statement like the following example:
proc printto; run;
Issuing these statements redirects the SAS procedure output to the default destination (filename.LST). In this way, you can send the output and log from different parts of the same SAS job to different files.
Note: If you route procedure output to a file, the resulting
file may contain carriage control characters. To suppress these control characters
when you include the file in the Program Editor window, set the RECFM= option
to P in the FILENAME statement.
If you want to send the SAS log to a specific file, use the LOG= option instead of the PRINT=option in the PROC PRINTTO statement. For more information about the PRINTTO procedure, see PRINTTO and SAS Procedures Guide.
Note: When you use the PRINTTO procedure to route SAS
procedure output or the SAS log, the status window does not reflect any rerouting
of batch output but indicates that it is routing the procedure output file
and log to filename.LST and filename.LOG.
Using SAS System Options |
sas -sysin c:\sas\prog1 -print c:\sas\prog1.txt
This SAS command executes the SAS program PROG1.SAS and sends the procedure output to the file C:\SAS\PROG1.TXT. You can treat the SAS Log similarly by using the LOG system option instead of the PRINT system option. Two other related system options, the ALTPRINT and ALTLOG options, are explained in ALTPRINT and ALTLOG.
Note: The status window does reflect the PRINT and LOG
system option values when it records where the procedure output and log are
being sent.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.