DATA Step, Macro, Functions and more

running the same code on multiple data

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 128
Accepted Solution

running the same code on multiple data

[ Edited ]

I have multiple datasets, I want to run the same code for each and then combine them in one dataset. Can do that in one step? 

 

data a; set dx_md_01;

where name in (druga, drugb, drugc);

run; 

 

data b; set dx_md_02;

where name in (druga, drugb, drugc);

run; 

 

data c; set dx_md_03;

where name in (druga, drugb, drugc);

run;

 

proc append base= a data=b;run;

proc append base= a data=c;run;

 


Accepted Solutions
Solution
‎10-04-2017 05:10 PM
Trusted Advisor
Posts: 1,918

Re: running the same code on multiple data

Posted in reply to lillymaginta
data all;
set dx_md_01 dx_md_02 dx_md_03;
where name in (druga, drugb, drugc);
run; 

View solution in original post


All Replies
Solution
‎10-04-2017 05:10 PM
Trusted Advisor
Posts: 1,918

Re: running the same code on multiple data

Posted in reply to lillymaginta
data all;
set dx_md_01 dx_md_02 dx_md_03;
where name in (druga, drugb, drugc);
run; 
Frequent Contributor
Posts: 128

Re: running the same code on multiple data

Posted in reply to PaigeMiller

Thank you! 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 147 views
  • 3 likes
  • 2 in conversation