%SYSCALL Statement

Invokes a SAS call routine.
Type: Macro statement
Restriction: Allowed in macro definitions or in open code
See: %SYSFUNC and %QSYSFUNC Functions

Syntax

%SYSCALL call-routine<(call-routine-argument-1 <...call-routine-argument-n>)> ;

Required Arguments

call-routine
is a SAS or user-written CALL routine created with SAS/TOOLKIT software or a routine created using the “FCMP Procedure” in Base SAS Procedures Guide. All SAS call routines are accessible with %SYSCALL except LABEL, VNAME, SYMPUT, and EXECUTE.
call-routine-argument-1 <...call-routine-argument-n>
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

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