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