proc print data=sashelp.class;
where weight>100;
run;
quit;
ods html;
ods listing close;
Output 9.2 Listing Output in the Windowing Environment
See the procedure descriptions in the Base SAS Procedures Guide for examples of output
from SAS procedures. For a discussion and examples of DATA step output, see the
“FILE Statement” in SAS Statements: Reference and the “PUT Statement” in SAS
Statements: Reference.
The SAS Log
Structure of the Log
The SAS log is a record of everything that you do in your SAS session or with your SAS
program. Original program statements are identified by line numbers. SAS messages are
interspersed with SAS statements. These messages might begin with the words NOTE,
INFO, WARNING, ERROR, or an error number, and they might refer to a SAS
statement by its line number in the log.
For example, in the following output, the number 1 is printed to the left of the OPTIONS
statement. This means that it is the first line in the program. In interactive mode, SAS
continues with the sequence of line numbering until you end your session. If you submit
the program again (or submit other programs in your current SAS session), the first
program line number is the next consecutive number.
Operating Environment Information
The SAS log appears differently depending on your operating environment. See the
SAS documentation for your operating environment.
164 Chapter 9 SAS Output
Log 9.1 Sample SAS Log
NOTE: Copyright (c) 2002-2012 by SAS Institute Inc., Cary, NC, USA. 1
NOTE: SAS (r) Proprietary Software 9.4 (TS1B0) 2
Licensed to SAS Institute Inc., Site 1. 3
NOTE: This session is executing on the W32_7PRO platform. 4
NOTE: SAS initialization used:
real time 4.19 seconds
cpu time 0.85 seconds
1 options pagesize=24
2 linesize=64 pageno=1 nodate; 5
3 data logsample; 6
5 infile
5 ! '\myservermy-directory-pathsampledata.dat'; 7
6 input LastName $ ID $ Gender $ Birth : date7. score1
6 ! score2 score3 score4 score5 score6 score7 score8;
7 format Birth mmddyy8.;
8 run;
NOTE: The infile
'\myservermy-directory-pathsampledata.dat' is: 8
Filename=\myservermy-directory-pathsampledata.dat,
RECFM=V,LRECL=256,File Size (bytes)=296,
Last Modified=08Jun2009:15:42:26,
Create Time=08Jun2009:15:42:26
NOTE: 5 records were read from the infile 9
'\myservermy-directory-pathsampledata.dat'.
The minimum record length was 58.
The maximum record length was 59.
NOTE: The data set WORK.LOGSAMPLE has 5 observations and 12
variables. 10
NOTE: DATA statement used (Total process time):
real time 0.21 seconds 11
cpu time 0.03 seconds
9
10 proc sort data=logsample; 12
11 by LastName;
12 run;
NOTE: There were 5 observations read from the data set
WORK.LOGSAMPLE.
NOTE: The data set WORK.LOGSAMPLE has 5 observations and 12
variables. 13
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
13
14 proc print data=logsample; 14
15 by LastName;
16 run;
NOTE: There were 5 observations read from the data set
WORK.LOGSAMPLE.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
The SAS Log 165
The following list corresponds to the circled numbers in the SAS log shown above:
1
copyright information
2
SAS system release used to run this program
3
name and site number of the computer installation where the program ran
4
platform used to run the program
5
OPTIONS statement to set a page size of 24, a line size of 64, and to suppress the
date in the output
6
SAS statements that make up the program (if the SAS system option SOURCE is
enabled)
7
long statement continued to the next line. Note that the continuation line is preceded
by an exclamation point (!), and that the line number does not change.
8
input file information-notes or warning messages about the raw data and where they
were obtained (if the SAS system option NOTES is enabled)
9
the number and record length of records read from the input file (if the SAS system
option NOTES is enabled)
10
SAS data set that your program created; notes that contain the number of
observations and variables for each data set created (if the SAS system option
NOTES is enabled)
11
reported performance statistics when the STIMER option or the FULLSTIMER
option is set
12
procedure that sorts your data set
13
note about the sorted SAS data set
14
procedure that prints your data set
The SAS Log in Interactive Mode
In interactive mode, the SAS log is opened when SAS starts. The SAS log is not named
until you save it in the active window. The name that you specify must follow the file
naming conventions for your operating environment. The SAS log cannot be saved
automatically in interactive mode. However, SAS can create a second copy of the SAS
log if the ALTLOG= system option is set either at SAS invocation or in a configuration
file.
The SAS Log in Batch, Line, or Objectserver Modes
Overview of the SAS Log in Batch, Line, or Objectserver Modes
If the LOGCONFIGLOC= system option is not specified when SAS starts, you can
configure the SAS log by using the LOG= system option or the LOGPARM= system
option. These options can be specified in batch mode, line mode, or objectserver mode.
If the LOGCONFIGLOC= system option is specified, logging is performed by the SAS
logging facility and the LOGPARM= option is ignored. The LOG= option is honored
only when the %S{App.Log} conversion character is specified in the logging
configuration file.
166 Chapter 9 SAS Output
The following sections discuss the log options that you can configure using the
LOGPARM= system option and how you would name the SAS log for those options
when the logging facility has not been initiated.
The LOG= system option names the SAS log. The LOGPARM= system option enables
you to perform the following tasks:
append or replace an existing SAS log
determine when to write to the SAS log
start a new SAS log under certain conditions
For information about these log system options, see “LOGPARM= System Option” in
SAS System Options: Reference in the documentation for your operating environment:
For information about the SAS logging facility, see SAS Logging: Configuration and
Programming Reference.
Appending to or Replacing the SAS Log
If you specify a destination for the SAS log in the LOG= system option, SAS verifies if
a SAS log already exists. If the log does exist, you can specify how content is written to
the SAS log by using the OPEN= option of the LOGPARM= system option:
OPEN=APPEND
appends the SAS log content to the existing SAS log
OPEN=REPLACE
replaces the existing SAS log
OPEN=REPLACEOLD
replace the existing SAS log if it is older than 24 hours
In the following SAS command, both the LOG= and LOGPARM= system options are
specified in order to replace an existing SAS log that is more than one day old:
sas -sysin "my-batch-program" -log "c:sasSASlogsmylog"
-logparm open=replaceold
The OPEN= option is ignored when the ROLLOVER= option of the LOGPARM=
system option is set to a specific size, n.
Specifying When to Write to the SAS Log
Content can be written to the SAS log either as the log content is produced or it can be
buffered and written when the buffer is full. By default, SAS writes to the log when the
log buffer is full. By buffering the log content, SAS performs more efficiently by writing
to the log file periodically instead of writing one line at a time.
Windows Specifics
Under Windows, the buffered log contents are written periodically, using an interval
specified by SAS.
You use the WRITE= option of the LOGPARM= system option to configure when the
SAS log contents are written. Set LOGPARM=“WRITE=IMMEDIATE” for the log
content to be written as it is produced and set LOGPARM=“WRITE=BUFFERED” for
the log content to be written when the buffer is full.
Rolling Over the SAS Log
Overview of Rolling Over the SAS Log: The SAS log can get very large for long
running servers and for batch jobs. By using the LOGPARM= and LOG= system options
together, you can specify to roll over the SAS log to a new SAS log. When SAS rolls
over the log, it closes the log and opens a new log.
The SAS Log 167
The LOGPARM= system option controls when log files are opened and closed and the
LOG= system option names the SAS log file. Logs can be rolled over automatically,
when a SAS session starts, when the log has reached a specific size, or not at all. By
using formatting directives in the SAS log name, each SAS log can be named with
unique identifiers.
Using Directives to Name the SAS Log: For the SAS log, a directive is a processing
instruction that is used to uniquely name the SAS log. By using directives, you can add
information to the SAS log name such as the day, the hour, the system node name, or a
unique identifier. You can include one or more directives in the name of the SAS log
when you specify the log name in the LOG= system option. For example, if you want
the SAS log name to include the year, the month, and the day, the LOG= system option
might look like this:
-log='c:saslog#Y#b#dsas.log'
When the SAS log is created on February 2, 2009, the name of the log is
2009Feb02sas.log.
Directives resolve only when the value of the ROLLOVER= option of the LOGPARM=
system option is set to AUTO or SESSION. If directives are specified in the log name
and the value of the ROLLOVER option is NONE or a specific size, n, the directive
characters, such as #b or #Y, become part of the log name. Using the example above for
the LOG= system option, if the LOGPARM= system option specifies
ROLLOVER=NONE, the name of the SAS log is #Y%b#dsas.log.
For a complete list of directives, see “LOGPARM= System Option” in SAS System
Options: Reference.
Automatically Rolling Over the SAS Log When Directives Change: When the SAS log
name contains one or more directives and the ROLLOVER= option of the LOGPARM=
system option is set to AUTO, SAS closes the log and opens a new log when the
directive values change. The new SAS log name contains the new directive values.
The follow table shows some of the log names that are created when SAS is started on
the second of the month at 6:15 AM, using this SAS command:
sas -objectserver -log "london#n#d#%H.log"
-logparm
"rollover=auto"
The directive #n inserts the system node name into the log name. #d adds the day of the
month to the log name. #H adds the hour to the log name. The node name for this
example is Thames. The log for this SAS session rolls over when the hour changes and
when the day changes.
Table 9.4 Log Names for Rolled Over Logs
Rollover Time Log Name
SAS initialization londonThames0206.log
First rollover londonThames0207.log
Last log of the day londonThames0223.log
First log past midnight londonThames0300.log
168 Chapter 9 SAS Output
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.174.0