Here is what I come up with, but still have two missing pieces: First, how do I create jrun dataset based on dependency dataset Second, how do I finish the following code without error? I did it using put statement in the data _null_; in the data step inside a macro do loop. It says I use put wrong. I use %put, but it outputs to the log. I don't know how to output a sas file using do loop macro. data jrun; length job_nm $20; input jid job_nm $; cards; 1 import_data.sas 2 check.sas 4 sum.sas run; %macro p_run(dsn); DATA _null_; FILE "~/p_run_&dsn.sas"; proc sql noprint; select count(distinct jid) into: jnm_nbr from &dsn ; select job_nm into: jnm1 - :jnm%trim(%left(&jnm_nbr)) from &dsn ; %put _user_; quit; %do n=1 %to &jnm_nbr; PUT "%runsasfile (spawning,&&jnm&n);"; put ""; %end; RUN; %mend; %p_run(jrun); /*result should look like this: in the code, p_run_jrun.sas, it has these lines: %runsasfile (spawning,import_data.sas); %runsasfile (spawning, check.sas); %runsasfile (spawning, sum.sas); */
... View more