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;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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