Required Arguments
call-routine
is a SAS or user-written CALL routine created with SAS/TOOLKIT software or a
routine created using “FCMP Procedure” in Base SAS Procedures Guide. All SAS
CALL routines are accessible with %SYSCALL except LABEL, VNAME,
SYMPUT, and EXECUTE.
call-routine-argument(s)
is one or more macro variable names (with no leading ampersands), separated by
commas. You can use a text expression to generate part or all of the CALL routine
arguments.
Details
When %SYSCALL invokes a CALL routine, the value of each macro variable argument
is retrieved and passed unresolved to the CALL routine. Upon completion of the CALL
routine, the value for each argument is written back to the respective macro variable. If
%SYSCALL encounters an error condition, the execution of the CALL routine
terminates without updating the macro variable values, an error message is written to the
log, and macro processing continues.
Note: The arguments to %SYSCALL are evaluated according to the rules of the SAS
macro language. This includes both the function name and the argument list to the
function. In particular, an empty argument position will not generate a NULL
argument, but a zero length argument.
CAUTION:
Do not use leading ampersands on macro variable names. The arguments in the
CALL routine invoked by the %SYSCALL macro are resolved before execution. If
you use leading ampersands, then the values of the macro variables are passed to the
CALL routine rather than the names of the macro variables.
CAUTION:
Macro variables contain only character data. When an argument to a function
might be either numeric data or character data, %SYSCALL attempts to convert the
supplied data to numeric data. This causes truncation of any trailing blanks if the
data was character data. %SYSCALL does not modify arguments that might be
character data. You can preserve the trailing blanks by using the %QUOTE function
when assigning the value to the macro variable that will be supplied as the argument
to the function. To determine whether it is necessary to preserve the trailing blanks
using the %QUOTE function, consult the documentation for the desired function to
see whether the arguments are numeric only, character only, or either numeric or
character. Use the %QUOTE function to quote the value supplied to arguments that
are documented to be either numeric or character.
%let j=1;
%let x=fax;
%let y=fedex;
%let z=phone;
%put j=&j x=&x y=&y z=&z
j=1 x=fax y=fedex z=phone
%syscall allperm(j,x,y,z);
%put j=&j x=&x y=&y z=&z
j=1 x=250 y=65246 z=phone
%SYSCALL Statement 337
Example: Using the RANUNI Call Routine with
%SYSCALL
This example illustrates the %SYSCALL statement. The macro statement %SYSCALL
RANUNI(A,B) invokes the SAS CALL routine RANUNI.
Note: The syntax for RANUNI is RANUNI(seed,x).
%let a = 123456;
%let b = 0;
%syscall ranuni(a,b);
%put &a, &b;
The %PUT statement writes the following values of the macro variables A and B to the
SAS log:
1587033266 0.739019954
%SYSEXEC Statement
Issues operating environment commands.
Type: Macro statement
Restriction: Allowed in macro definitions or open code
See: “SYSSCP and SYSSCPL Automatic Macro Variables” on page 224 and “SYSRC
Automatic Macro Variable” on page 223
“Macro Statements in UNIX Environments” in SAS Companion for UNIX
Environments
“Macro Statements” in SAS Companion for Windows
“Macro Statements” in SAS Companion for z/OS
Syntax
%SYSEXEC<command> ;
Required Arguments
no argument
puts you into operating environment mode under most operating environments,
where you can issue operating environment commands and return to your SAS
session.
command
is any operating environment command. If command contains a semicolon, use a
macro quoting function.
Details
The %SYSEXEC statement causes the operating environment to immediately execute
the command that you specify and assigns any return code from the operating
environment to the automatic macro variable SYSRC. Use the %SYSEXEC statement
338 Chapter 19 Macro Statements
and the automatic macro variables SYSSCP and SYSSCPL to write portable macros that
run under multiple operating environments.
Operating Environment Information
The following items related to the use of the %SYSEXEC statement are operating
environment specific. For more information, see the SAS documentation for your
operating environment.
the availability of the %SYSEXEC statement in batch processing, noninteractive
mode, or interactive line mode.
how you return from operating environment mode to your SAS session after
executing the %SYSEXEC statement with no argument.
the commands to use with the %SYSEXEC statement.
the return codes that you get in the automatic macro variable SYSRC.
Comparisons
The %SYSEXEC statement is analogous to the X statement and the X windowing
environment command. However, unlike the X statement and the X windowing
environment command, host commands invoked with %SYSEXEC should not be
enclosed in quotation marks.
%SYSLPUT Statement
Creates a new macro variable or modifies the value of an existing macro variable on a remote host or
server.
Type: Macro Statement
Restriction: Allowed in macro definitions or open code
Requirement: SAS/CONNECT
See: “Use the Macro Facility with SAS/CONNECT” in SAS/CONNECT User’s Guide
“%LET Statement” on page 322 and “%SYSRPUT Statement” on page 342
Syntax
%SYSLPUT macro-variable=value</REMOTE=remote-session-identifier>;
%SYSLPUT _ALL_ | _AUTOMATIC_ | _GLOBAL_ | _LOCAL_ | _USER_
</LIKE=‘character-string’><REMOTE=server-ID>;
Required Arguments
Form 1
macro-variable
is either the name of a macro variable or a macro expression that produces a macro
variable name. The name can refer to a new or existing macro variable on a remote
host or server.
remote-session-identifier
is the name of the remote session.
%SYSLPUT Statement 339
value
is a string or a macro expression that yields a string. Omitting the value produces a
null (0 characters). Leading and trailing blanks are ignored. To make them
significant, enclose the value in the %STR function.
Optional Arguments
Form 2
_ALL_
copies all user-generated and automatic macro variables to the server session.
_AUTOMATIC_
copies all automatic macro variables to the server session. The automatic variables
copied depend on the SAS products installed at your site and on your operating
system. The scope is identified as AUTOMATIC.
_GLOBAL_
copies all user-generated global macro variables to the server session. The scope is
identified as GLOBAL.
_LOCAL_
copies all user-generated local macro variables to the server session. The scope is the
name of the currently executing macro.
macro-variable
specifies the name of a macro variable to be created in the server session.
value
specifies the macro variable reference, a macro invocation, or the character value
to be assigned to the server macro-variable. The character value should not
contain nested quotation marks.
Requirement
Values containing special characters, such as the forward slash (/)
or single quotation mark (‘), must be masked using the
%BQUOTE function so that the macro processor correctly
interprets the special character as part of the text and not as an
element of the macro language. See “Mask Character Values with
%BQUOTE (Form 1)” in SAS/CONNECT Users Guide for an
example of how to use the %BQUOTE function. For more
information about Macro Quoting in general, see Chapter 7,
“Macro Quoting,” on page 81.
/REMOTE=server-ID
specifies the name of the server session that the macro variable will be created in. If
only one server session is active, the server-ID can be omitted. If multiple server
sessions are active, omitting this option causes the macro to be created in the most
recently accessed server session. You can find out which server session is currently
active by examining the value that is assigned to the CONNECTREMOTE system
option.
Interactions
The /REMOTE= option that is specified in the %SYSLPUT macro
statement overrides the CONNECTREMOTE= system option.
The /REMOTE= and /LIKE= options are independent of each other
and can be specified on the same %SYSLPUT statement, regardless of
order.
340 Chapter 19 Macro Statements
_USER_
to push all user-defined macro variables from the local host to the remote host or
server all at the same time.
Specifies a subset of macro variables whose names match a user-specified character
sequence, or pattern. Only this identified group of variables with names matching the
pattern will be copied to the server session.
/LIKE=‘character-string’
Specifies the sequence of characters, or pattern, to be used as the criteria for
determining which macro variables are to be copied to the server session.
Character patterns can consist of the following:
any sequence of characters, A-Z
any sequence of digits, 0-9
a single wildcard character in the form of an asterisk (*)
The wildcard character (*) cannot be embedded or used more than once in the
character string.
Restrictions
The wildcard character (*) cannot be embedded in the character
string.
The wildcard character (*) can be specified only once in the
character string.
Requirement
The wildcard character (*) must be used at either the beginning or
the end of the character string.
Note
The LIKE= option is not case sensitive.
See
For more detailed information, see “/LIKE=‘character-string’ ” in
SAS/CONNECT Users Guide.
Details
The %SYSLPUT statement is submitted with SAS/CONNECT software from the local
host or client to a remote host or server to create a new macro variable on the remote
host or server, or to modify the value of an existing macro variable on the remote host or
server.
Note: The names of the macro variables on the remote and local hosts must not contain
any leading ampersands.
To assign the value of a macro variable on a remote host to a macro variable on the local
host, use the %SYSRPUT statement.
To use %SYSLPUT, you must have initiated a link between a local SAS session or client
and a remote SAS session or server using the SIGNON command or SIGNON
statement. For more information, see the documentation for SAS/CONNECT software.
%SYSMACDELETE Statement
Deletes a macro definition from the Work.SASMacr catalog.
Type: Macro Statement
%SYSMACDELETE Statement 341
..................Content has been hidden....................

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