Hi,
i have 20 sas codes saved in c:/fc/sascd1.sas paricular location.
how i have to execute all sas codes at a time.
Thanks
Do you want to run them in any specific order?
hi,
i have to run those sas codes one after another
how to do in sas programming?
@suhas1 wrote:
hi,
i have to run those sas codes one after another
how to do in sas programming?
Is there a specific order, or do we simply run all .sas files in a directory as retrieved with a directory listing?
If there is an order, create a dataset with the program names and do
data _null_;
set myprograms;
call execute(cats('%include "',progname,'";'));
run;
HI,
i have all sascode files saved in c drive.
i have to run all sascodes files one by one automatically.
Thanks.
@suhas1 wrote:
HI,
i have all sascode files saved in c drive.
i have to run all sascodes files one by one automatically.
Thanks.
See my code example.
The easiest way to execute SAS code stored in an external SAS file is to use an %include statement. This just makes the code available to the programs you're running. If using multiple %include statements then it executes everything sequentially in a single SAS session - exactly in the same way it would if you'd copied all the code into a single file.
%include 'c:\<some path>\myprog1.sas' / source2;
%include 'c:\<some path>\myprog2.sas' / source2;
%include 'c:\<some path>\myprog3.sas' / source2;
To include external .sas files they must be accessible from the location where SAS executes (your SAS server). As you write "c-drive" I assume these .sas files are on your local machine and though you will need a local SAS installation for things to work.
On a UNIX system, I'd have a script like
cd /location for PNAME in *.sas do /sasconf/Lev1/SASApp/BatchServer/sasbatch.sh /location/$PNAME done
On a Windows system, you do the same (logically), but the shell script syntax will be different (unless you have bash available).
What do you mean by sas code ?
How are the sas codes organized in the c:/fc/sascd1.sas ?
c:/fc/sascd1.sas is one file - is it an example out of 20 files or one file that contains all 20 sas codes?
Is sas code a macro program or not ? are all sas codes macro programs ?
%include 'c:\<some path>\*.sas' / source2;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.