BookmarkSubscribeRSS Feed
nikcmo
Calcite | Level 5

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.

2 REPLIES 2
nikcmo
Calcite | Level 5

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.

Tom
Super User Tom
Super User

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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 397 views
  • 0 likes
  • 2 in conversation