Hello,
What could be the other way of running all the sas codes without using call execute ?
Regards,
Jai
Your situation is not clear.
There is not enough information what do you mean by all the sas codes .
You do not need macro programming to replace CALL EXECUTE.
In some cases, instead CALL EXECUTE it is more convenient to generate the program as a file.
When ready run %include of that file/program to execute it. It is much easier to debug it.
Hello,
The way we will use the Call Execute for running multiple SAS Macro, Consider the below example.
Data Data1;
call execute ('%macro1');
run;
Could you suggest way to execute the multiple macro / all the sas codes without using call execute ?
People suggested today "%include", That looks good me, Likewise do you have any other approach ?
Regards,
Jai
you could call each SAS program with an include statement.
First point to the SAS progams
%include "mypath/prog1.sas";
%include "mypath/prog2.sas"
then call the SAS programs
%prog1;
%prog2;
Most of the time, I use a datastep which writes code, and then a %INCLUDE statement to execute the code.
I prefer it to CALL EXECUTE because when you are developing, you can take a look at the code you have generated before submitting it, and when you have many steps in the generated code, you can submit them one at a time, to see if the results are as expected before going on.
E.g.:
filename tempsas temp;
data _null_;
file tempsas;
/* here are the statements to write the code */
run;
%include tempsas;
I get confuse with %include, Could you please explain the full syntax for it Correct me if i'm wrong below.
1. How to create store the program in file.
Filename Myfile "C:/Myfile/Test/exp.?" -----Here What should be the file extension name ? would it should be .SAS ?
2. %include "???"; --What should be here exact path with File name and .ext ?
Regards,
Jai
What I very often do is exactly what I demonstrated. By allocating the file using the "temp" directive, it gets allocated in the Work directory (slightly different on z/OS, but that's another story). And the file will automatically be deleted when freed.
Yes. Use the extension .SAS
and then %Include Myfile;
You don't need the path on the include statement.
filename x '\my_code_path\';
%include x /source2 lrecl=1000000;
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!
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.