%let sysmsg=Press ENTER to continue.;
%window start
#5 @28 'Welcome to SAS';
%display start;
%put Sysmsg is: *&sysmsg*;
When this program executes, the following is written to the SAS log:
Sysmsg is: **
SYSNCPU Automatic Macro Variable
Contains the current number of processors available to SAS for computations.
Type: Automatic Macro Variable (Read Only)
Details
SYSNCPU is an automatic macro variable that provides the current value of the
CPUCOUNT option. For more information, see “CPUCOUNT= System Option” in SAS
System Options: Reference.
Comparisons
The following example shows the option CPUCOUNT set to 265.
options cpucount=265;
%put &sysncpu;
The output of the above example is 265.
SYSNOBS Automatic Macro Variable
Contains the number of observations read from the last data set that was closed by the previous procedure
or DATA step.
Type: Automatic macro variable (read and write)
Details
SYSNOBS automatic macro variable contains the number of observations read from the
last data set that was closed by the previous procedure or DATA step.
Note: If the number of observations for the data set was not calculated by the previous
procedure or DATA step, the value of SYSNOBS is set to -1.
SYSODSESCAPECHAR Automatic Macro Variable
Displays the value of the ODS ESCAPECHAR= from within the program.
Type: Automatic macro variable (read only)
218 Chapter 14 Automatic Macro Variables
Details
SYSODSESCAPECHAR automatic macro variable contains the current ODS escape
character.
SYSODSPATH Automatic Macro Variable
Contains the current Output Delivery System (ODS) pathname.
Type: Automatic macro variable (read only)
Restriction: The SYSODSPATH automatic macro variable exists only after an ODS or PROC
TEMPLATE statement is invoked.
Details
The SYSODSPATH automatic macro variable contains the current ODS template search
path.
ODS;
%put &sysodspath;
SASUSER.TEMPLAT(UPDATE) SASHELP.TMPLMST(READ)
SYSPARM Automatic Macro Variable
Contains a character string that can be passed from the operating environment to SAS program steps.
Type: Automatic macro variable (read and write)
Details
SYSPARM enables you to pass a character string from the operating environment to
SAS program steps and provides a means of accessing or using the string while a
program is executing. For example, you can use SYSPARM from the operating
environment to pass a title statement or a value for a program to process. You can also
set the value of SYSPARM within a SAS program. SYSPARM can be used anywhere in
a SAS program. The default value of SYSPARM is null (zero characters).
SYSPARM is most useful when specified at invocation of SAS. For more information,
see the SAS documentation for your operating environment.
Note: The macro processor always stores the value of SYSPARM in unquoted form. To
quote the resolved value of SYSPARM, use the %SUPERQ macro quoting function.
Comparisons
Assigning a value to SYSPARM is the same as specifying a value for the
SYSPARM= system option.
Retrieving the value of SYSPARM is the same as using the SYSPARM() SAS
function.
SYSPARM Automatic Macro Variable 219
Example: Passing a Value to a Procedure
In this example, you invoke SAS on a UNIX operating environment on September 20,
2011 (the librefs Dept and Test are defined in the config.sas file) with a command like
the following:
sas program-name -sysparm dept.projects -config /myid/config.sas
Macro variable SYSPARM supplies the name of the data set for PROC REPORT:
proc report data=&sysparm
report=test.resorces.priority.rept;
title "%sysfunc(date(),worddate.)";
title2;
title3 'Active Projects By Priority';
run;
SAS sees the following:
proc report data=dept.projects
report=test.resorces.priority.rept;
title "September 20, 2011";
title2;
title3 'Active Projects By Priority';
run;
SYSPBUFF Automatic Macro Variable
Contains text supplied as macro parameter values.
Type: Automatic macro variable (read and write, local scope)
Details
SYSPBUFF resolves to the text supplied as parameter values in the invocation of a
macro that is defined with the PARMBUFF option. For name-style invocations, this text
includes the parentheses and commas. Using the PARMBUFF option and SYSPBUFF,
you can define a macro that accepts a varying number of parameters at each invocation.
If the macro definition includes both a set of parameters and the PARMBUFF option, the
macro invocation causes the parameters to receive values and the entire invocation list of
values to be assigned to SYSPBUFF.
Note: The SYSPBUFF automatic macro variable can be modified only within the scope
that it resides. Any attempt to assign a value to SYSPBUFF within an inner scope
not already containing an instance of SYSPBUFF causes a new instance of
SYSPBUFF to be created within that inner scope.
Example: Using SYSPBUFF to Display Macro Parameter
Values
The macro PRINTZ uses the PARMBUFF option to define a varying number of
parameters and SYSPBUFF to display the parameters specified at invocation.
%macro printz/parmbuff;
%put Syspbuff contains: &syspbuff;
%let num=1;
220 Chapter 14 Automatic Macro Variables
%let dsname=%scan(&syspbuff,&num);
%do %while(&dsname ne);
proc print data=&dsname;
run;
%let num=%eval(&num+1);
%let dsname=%scan(&syspbuff,&num);
%end;
%mend printz;
%printz(purple,red,blue,teal)
When this program executes, this line is written to the SAS log:
Syspbuff contains: (purple,red,blue,teal)
SYSPRINTTOLIST Automatic Macro Variable
Contains the path of the LIST file prior to redirection by the PRINTTO procedure.
Type: Automatic macro variable (read only)
Details
The SYSPRINTTOLIST automatic macro variable contains the destination path for the
LIST file set by the PRINTTO procedure in the current execution scope.
Note: If no redirection of the LIST file has occurred, then the value of the
SYSPRINTTOLIST automatic macro variable is null.
SYSPRINTTOLOG Automatic Macro Variable
Contains the path of the LOG file prior to redirection by the PRINTTO procedure.
Type: Automatic macro variable (read only)
Details
The SYSPRINTTOLOG automatic macro variable contains the destination path for the
LOG file set by the PRINTTO procedure in the current execution scope.
Note: If no redirection of the LOG file has occurred, then the value of the
SYSPRINTTOLOG automatic macro variable is null.
SYSPROCESSID Automatic Macro Variable
Contains the process ID of the current SAS process.
Type: Automatic macro variable (read only)
Default: null
SYSPROCESSID Automatic Macro Variable 221
Details
The value of SYSPROCESSID is a SAS internally generated 32–character hexadecimal
string. The default value is null.
Example: Using SYSPROCESSID to Display the Current
SAS Process ID
The following code writes the current SAS process ID to the SAS log:
%put &sysprocessid;
A process ID, such as the following, is written to the SAS log:
41D1B269F86C7C5F4010000000000000
SYSPROCESSMODE Automatic Macro Variable
Contains the name of the current SAS session run mode or server type.
Type: Automatic macro variable (read-only)
Details
SYSPROCESSMODE is a read-only automatic macro variable, which contains the name
of the current SAS session run mode or server type, such as the following:
SAS DMS Session
SAS Batch Mode
SAS Line Mode
SAS/CONNECT Session
SAS Share Server
SAS IntrNet Server
SAS Workspace Server
SAS Pooled Workspace Server
SAS Stored Process Server
SAS OLAP Server
SAS Table Server
SAS Metadata Server
Example: Using SYSPROCESSMODE to Display the
Current SAS Process Run Mode or Server Type
%put &sysprocessmode;
A run mode or server type, such as the following is written to the log:
222 Chapter 14 Automatic Macro Variables
..................Content has been hidden....................

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