Rolling Over the SAS Log by SAS Session: To roll over the log at the start of a SAS
session, specify the LOGPARM=“ROLLOVER=SESSION” option when SAS starts.
SAS resolves the system-specific directives by using the system information obtained
when SAS starts. No roll over occurs during the SAS session and the log file is closed at
the end of the SAS session.
Rolling Over the SAS Log by the Log Size: To roll over the log when the log reaches a
specific size, specify the LOGPARM=“ROLLOVER=n” option when SAS starts. n is
the maximum size of the log, in bytes, and it cannot be smaller than 10K (10,240) bytes.
When the log reaches the specified size, SAS closes the log and appends the text “old” to
the filename (for example, londonold.log). SAS opens a new log using the value of the
LOG= option for the log name and ignores the OPEN= option statement in the
LOGPARM system option. This is done so that SAS never writes over an existing log
file. Directives in log names are ignored for logs that roll over based on log size.
To ensure unique log filenames between servers, SAS creates a lock file that is based on
the log filename. The lock filename is logname.lck, where logname is the value of the
LOG= option. If a lock file exists for a server log and another server specifies the same
log name, the log and lock filenames for the second server have a number appended to
the names. The numbers begin with 2 and increment by 1 for subsequent requests for the
same log filename. For example, if a lock exists for the log file london.log, the second
server log would be london2.log and the lock file would be london2.lck.
No SAS Log Roll Over: To not roll over the log at all, specify the LOGPARM=
“ROLLOVER=NONE” option when SAS starts. Directives are not resolved and no
rollover occurs. For example, if LOG=“March#b.log”, the directive #b does not resolve
and the log name is March#b.log.
Writing to the Log in All Modes
In all modes, you can instruct SAS to write additional information to the log by using the
following statements:
PUT statement
writes selected lines (including text strings and DATA step variable values) to the
SAS log in the current iteration of a DATA step. If a FILE statement with the LOG
destination executes before a PUT statement, the PUT statement output is directed to
a destination that is specified by the FILE statement.
%PUT statement
enables you to write a text string or macro variable values to the SAS log. %PUT is a
SAS macro program statement that is independent of the DATA step and can be used
anywhere.
PUTLOG statement
writes a user-specified message to the SAS log. Use the PUTLOG statement in a
DATA step.
LIST statement
writes to the SAS log the input data records for the data line that is being processed.
The LIST statement operates only on data that are read with an INPUT statement. It
has no effect on data that are read with a SET, MERGE, MODIFY, or UPDATE
statement. Use the LIST statement in a DATA step.
DATA statement with /NESTING option
writes to the SAS log a note for the beginning and end for each nesting level of DO-
END and SELECT-END statements. This enables you to debug mismatched DO-
END and SELECT-END statements.
The SAS Log 169
ERROR statement
sets the automatic _ERROR_ variable to 1 and (OPTIONAL) writes to the log a
message that you specify. Use the ERROR statement in a DATA step.
Use the PUT, PUTLOG, LIST, DATA, and ERROR statements in combination with
conditional processing to debug DATA steps by writing selected information to the log.
Customizing the Log
Altering the Contents of the Log
When you have large SAS production programs or an application that you run on a
regular basis without changes, you might want to suppress part of the log. SAS system
options enable you to suppress SAS statements and system messages, as well as to limit
the number of error messages. Note that all SAS system options remain in effect for the
duration of your session or until you change the options. You should not suppress log
messages until you have successfully executed the program without errors.
The following list describes some of the SAS system options that you can use to alter the
contents of the log:
CPUID | NOCPUID
specifies whether hardware information is written to the SAS log.
ECHO
specifies a message to be written to the SAS log while SAS initializes. The ECHO
system option is valid only under the Windows and UNIX operating environments.
ECHOAUTO | NOECHOAUTO
specifies whether autoexec code in an input file is written to the log.
ERRORS=n
specifies the maximum number of observations for which data error messages are
printed.
FULLSTATS
writes expanded statistics to the SAS log. The FULLSTATS system option is valid
only under z/OS.
FULLSTIMER
writes a subset of system performance statistics to the SAS log.
ISPNOTES
specifies whether ISPF error messages are written to the SAS log. The ISPNOTES
system option is valid only under the z/OS operating environment.
HOSTINFOLONG
writes additional operating environment information to the SAS log when SAS
starts.
LOGPARM “OPEN=APPEND | REPLACE | REPLACEOLD”
when a log file already exists and SAS is opening the log, the LOGPARM option
specifies whether to append to the existing log or to replace the existing log. The
REPLACEOLD option specifies to replace logs that are more than one day old.
MEMRPT
specifies whether memory usage statistics are written to the SAS log for each step.
The MEMRPT system option is valid only under the z/OS operating environment.
MLOGIC
writes macro execution trace information to the SAS log.
170 Chapter 9 SAS Output
MLOGICNEST
writes macro nesting execution trace information to the SAS log.
MPRINT | NOMPRINT
specifies whether SAS statements that are generated by macro execution are written
to the SAS log.
MSGLEVEL=N | I
specifies the level of detail in messages that are written to the SAS log. If the
MSGLEVEL system option is set to N, the log displays notes, warnings, and error
messages only. If MSGLEVEL is set to I, then the log displays additional notes
pertaining to index usage, merge processing, HADOOP MapReduce jobs, and sort
utilities.
NEWS=external-file
specifies whether news information that is maintained at your site is written to the
SAS log.
NOTES | NONOTES
specifies whether notes (messages beginning with NOTE) are written to the SAS log.
NONOTES does not suppress error or warning messages.
OPLIST
specifies whether to write to the SAS log the values of all system options that are
specified when SAS is invoked.
OVP | NOOVP
specifies whether error messages that are printed by SAS are overprinted.
PAGEBREAKINITIAL
specifies whether the SAS log and the listing file begin on a new page.
PRINTMSGLIST | NOPRINTMSGLIST
specifies whether extended lists of messages are written to the SAS log.
RTRACE
produces a list of resources that are read during SAS execution and writes them to
the SAS log if a location is not specified for the RTRACELOC= system option. The
RTRACE system option is valid only for the Windows and UNIX operating
environments.
SOURCE | NOSOURCE
specifies whether SAS writes source statements to the SAS log.
SOURCE2 | NOSOURCE2
specifies whether SAS writes secondary source statements from files included by
%INCLUDE statements to the SAS log.
SYMBOLGEN | NOSYMBOLGEN
specifies whether the results of resolving macro variable references are written to the
SAS log.
VERBOSE
specifies whether SAS writes to the batch log or to the computer monitor the values
of the system options that are specified in the configuration file.
See SAS System Options: Reference for more information about how to use these and
other SAS system options.
Operating Environment Information
See the documentation for your operating environment for other options that affect
log output.
The SAS Log 171
Customizing the Appearance of the Log
The following SAS statements and SAS system options enable you to customize the log.
Customizing the log is helpful when you use the log for report writing or for creating a
permanent record.
DATE system option
controls whether the date and time that the SAS job began are printed at the top of
each page of the SAS log and any output created by SAS.
DETAILS | NODETAILS
specifies whether to include additional information when files are listed in a SAS
library.
DMSLOGSIZE= system option
specifies the maximum number of rows to display in the SAS log window.
DTRESET | NODTRESET
specifies whether to update the date and time in the SAS log and in the listing file.
FILE statement
enables you to write the results of PUT statements to an external file. You can use the
following two options in the FILE statement to customize the log for that report.
LINESIZE=value specifies the maximum number of columns per line for
reports and the maximum record length for data files.
PAGESIZE=value specifies the maximum number of lines to be printed on
each page of output.
Note: FILE statement options apply only to the output specified in the FILE
statement, whereas the LINESIZE= and PAGESIZE= SAS system options apply
to all subsequent listings.
LINESIZE= system option
specifies the line size (printer line width) for the SAS log and SAS output that are
used by the DATA step and procedures.
MSGCASE
specifies whether to display notes, warning, and error messages in uppercase letters
or lowercase letters.
MISSING= system option
specifies the character to be printed for missing numeric variable values.
NUMBER system option
controls whether the page number is printed on the first title line of each page of
printed output.
PAGE statement
skips to a new page in the SAS log and continues printing from there.
PAGESIZE= system option
specifies the number of lines that you can print per page of SAS output.
SKIP statement
skips a specified number of lines in the SAS log.
STIMEFMT= system option
specifies the format to use for displaying the read and CPU processing times when
the STIMER system option is set. The STIMEFMT= system option is valid under
Windows, VMS, and UNIX operating environments.
Operating Environment Information
172 Chapter 9 SAS Output
The range of values for the FILE statement and for SAS system options depends on
your operating environment. See the SAS documentation for your operating
environment for more information.
For more information about how to use these and other SAS system options and
statements, see SAS System Options: Reference.
Other System Options That Affect the SAS Log
The following system options pertain to the SAS log other than by the content and
appearance of the SAS log:
ALTLOG= system option
specifies the destination for a copy of the SAS log.
LOG= system option
specifies the destination for the SAS log when SAS is run in batch mode.
LOGAPPLNAME
specifies a SAS session name that can be used for SAS logging.
The SAS Log 173
..................Content has been hidden....................

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