If you have the program for one dataset, I would suggest trying this: Write another SAS program, which writes the first program, and put the variable parameters in datastep variables, e.g.: filename tempsas temp; /* you can also allocate a permanent file here */
data _null_;
input dsname $;
file tempsas;
put
'data outlib.' dsname ';' /
' set inlib.' dsname '(keep=a b c d f);' /
' where c<33;' /
'run;' /
;
cards;
mydata
yourdata
hisdata
herdata
ourdata
;run; You can then take a look at the code that is generated (open the TEMPSAS file in an editor window). If it looks OK, try submitting one code section (one datastep in the example), and see if the results are what you expected. If it looks OK, submit some more and check the log and the output. If something goes wrong, go back and change the original program (the one that wrote the code) and submit it again. When all looks OK, you can insert the line "%include tempsas;" at the bottom of your original program. A lot of people want to use macros and call execute. That may work too, but you have a lot less control of the process, and it is much harder to debug.
... View more