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