Hi Team,
Here is what i need help into.
I have two macro definations
Macro1 and Macro2
and they have macro calls as
%macro1(a,b,c)
%macro1(a1,b1,c1)
%macro1(a2,b2,c2)
%macro2(p1,q1,r1,s1)
%macro2(p2,q2,r2,s2)
%macro2(p3,q3,r3,s3)
%macro2(p4,q4,r4,s4)
Both macro1 and macro2 have proc sql statement within them and output a 2 column 2 row output(1st row headers,which are differant for each macro call and second rows are numeric values.)
I want to append all results of macro calls(for both tables) into a SAS dataset.Please help me on this.Thanks!
Here are two options.
Option 1:
Make each macro generate an output table with a unique name and then appemd the results. Use a naming convention, such as a common prefix so that you can use either a colon or list to append all easily.
Data results;
set result1-result10;*appends all tables in between result1, result2, etc;
run;
OR
data want;
Set result:; *will append any table starting with the work result;
run;
Option 2:
Or have each iteration of the macro append the results to a main result table. If you rerun a section you'll end up,with duplicate results so would need to manage that.
For this option look at PROC appemd.
Hi..thanks for reply,here is what i am trying to do now....i generated tables with differant names....
Make them have the same name in your macro don't fix it after.
Make them have the same name in your macro don't fix it after.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.