Unix Global SAS macro variables

 

SAS macro variables can be passed from the local machine(client session) to the remote machine(server session) using the %SYSLPUT statement and back to the local machine using the %SYSRPUT statement. Once the %SYSLPUT statement assigns a macro variable it is available to multiple server sessions. Once the %SYSRPUT statement assigns a macro variable it is available to multiple client sessions.

It is necessary to use the %BQUOTE function to mask slashes in the macro variables.

Example code:

signon                                          ;    
%LET FOLDER=C:\MY_FOLDER                        ;
%SYSLPUT FOLDER=%BQUOTE(&FOLDER)                ;
RSUBMIT                                         ;
 %PUT %STR(----------FOLDER=&FOLDER)            ;
 %LET FOLDER=&FOLDER.\SECOND_NODE               ;
 %SYSRPUT FOLDER=%BQUOTE(&FOLDER)               ;
ENDRSUBMIT                                      ;
%PUT %STR(-----------FOLDER=&FOLDER)            ;
RSUBMIT                                         ;
 %LET FOLDER=&FOLDER.\SECOND_NODE\THIRD_NODE    ; 
ENDRSUBMIT                                      ;
%PUT %STR(-----------FOLDER=&FOLDERR)           ;
signoff                                         ;

SAS log generated: