BookmarkSubscribeRSS Feed
jaiganesh
Obsidian | Level 7

Hello,

 

 

What could be the other way of running all the sas codes without using call execute ?

 

 

 

Regards,

Jai

8 REPLIES 8
Shmuel
Garnet | Level 18

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.

jaiganesh
Obsidian | Level 7

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

 

 

VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

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;

 

 

s_lassen
Meteorite | Level 14

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;
jaiganesh
Obsidian | Level 7

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

s_lassen
Meteorite | Level 14

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.

DanielLangley
Quartz | Level 8

Yes. Use the extension .SAS

 

and then %Include Myfile;

You don't need the path on the include statement.

Ksharp
Super User

filename x '\my_code_path\';

%include x /source2 lrecl=1000000;

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
  • 8 replies
  • 2118 views
  • 0 likes
  • 6 in conversation