BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Junyong
Pyrite | Level 9

I want to run the following a.sas and b.sas in a sequential way.

data a;
a=1;
run;
proc export file="!userprofile\desktop\a.csv";
run;
data b;
b=1;
run;
proc export file="!userprofile\desktop\b.csv";
run;

I wrote a batch file ab.bat to run them and found that this batch opens the second parallel SAS session before finishing the first one.

"%programfiles%\sashome\sasfoundation\9.4\sas" %userprofile%\desktop\a.sas -nolog
"%programfiles%\sashome\sasfoundation\9.4\sas" %userprofile%\desktop\b.sas -nolog

Unlike this MWE, my SAS files are dependent. How can I run the two SAS files non-simultaneously?

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

If you don't want to put all of the code in a single file you can use a single program to include the program files. Basically a single program file that looks like the following (where path is appropriate for your operating system). The path is generally best if starting at a drive or disk mount and not a relative path.

 

%include "<path>\a.sas";

%include "<path>\b.sas";

 

View solution in original post

2 REPLIES 2
ballardw
Super User

If you don't want to put all of the code in a single file you can use a single program to include the program files. Basically a single program file that looks like the following (where path is appropriate for your operating system). The path is generally best if starting at a drive or disk mount and not a relative path.

 

%include "<path>\a.sas";

%include "<path>\b.sas";

 

Junyong
Pyrite | Level 9

Thanks, but I wondered if I can do this with batch files due to this reason—to avoid possible interference.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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