DATA Step, Macro, Functions and more

more macros within one macro

Reply
Super Contributor
Super Contributor
Posts: 440

more macros within one macro

hi all,

Can i have more macro codes written within one and then by callin the main one i can execute all?

Also,i have  a dataset out of each i am supposed to run 10 queries.Can I write a macro that would export the results of all these 10 queries into one workbook of excel?

Not all of the 10 queries have the same column names.And if macro cant,can i do the same then without macro?

I am need to have the results of all the queries on one workbook so i can easily populate some tables in excel

Please anyone

Super User
Super User
Posts: 6,502

Re: more macros within one macro

A macro can call anything you want it to.

%macro big ;

    %small1;

     %small2;

%mend big;

Look at using ODS TAGSETS.EXCELXP to generate output into multiple sheets of an excel file.

Super Contributor
Super Contributor
Posts: 440

Re: more macros within one macro

sorry i meant to ask if i can have sas export the results of all the queries onto one worksheet but i guess  that s not possible.

Thanks Tom

Super User
Posts: 17,868

Re: more macros within one macro

Yes you can, but you'll have different tables is all, they won't stack up.

ods tagsets.excelxp file="c:\temp\test.xls";

proc print data=sashelp.class;

run;

proc print data=sashelp.cars;

run;

ods tagsets.excelxp close;

Super Contributor
Super Contributor
Posts: 440

Re: more macros within one macro

will try this today

Thanks Reeza

Ask a Question
Discussion stats
  • 4 replies
  • 150 views
  • 0 likes
  • 3 in conversation