I'm attempting to run two pieces of code in parallel while defining a number of system variables. The code need to be run in parallel to save time, and the main program needs to be able to set parameters in the macros that are being run in parallel. To achieve this, I've been defining environment variables in the systask command statement and then referencing them in later programs. The above is a simplification of the caller program and the below is a simplification of one of the called programs.
%macro caller(var1=10, var2=20);
systask command " sas ""C:\Users\...\testing.sas"" -log ""C:\Users.\...\testing.log"" -set var1 &var1. -set var2 &var2."
systask command " sas ""C:\Users\...\testing2.sas"" -log ""C:\Users.\...\testing2.log"" -set var1 &var1. -set var2 &var2."
%mend;
%caller;
%macro testing(var1=%sysget(var1), var2=%sysget(var2));
%put var1: &var1.
%put var2: &var2.
%mend;
%testing
The issue is that, although the maximum character length for the program is 8,191 based on my version of Windows (running SAS 9.4). Nothing happens once the number of characters exceeds 262 which happens when more environment variables are set. There is no error message. The only thing in the log of the caller file is.
NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation marks.
The log for the called file (testing.log) does not update at all.
Setting
options noquotelenmax;
removes the note in the log, but the called program still does not run.
Thanks for the help.
Was able to resolve this issue by using an autoexec file instead of defining environment variables in the systask command statement. Would still be interested to know why this did not work initially.
Probably a limitation of the SYSTASK statement (at least on Windows).
Just write and run a .BAT file instead. That way you can also simplify by using normal Windows statements to set the environment variables.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.