Hi,
I am using a macro to repeat a proc report with macro-parameters taking different values.
I want to export all these proc report outputs to one sheet of an excel file. I managed to do it without problem.
Yet, i want the first proc report to start at column B (let's say for the first one B1)
The next ones starting at column A
And then another one starting at column B
How can i do that ?
I tried this but turns out all tables are starting at column B (B1 for the first table, B12 for the second table, etc..)
ods excel file = '' ;
%macro report (in= , title = ...) ;
proc report data = &in. ;
.. ;
run ;
%mend ;
ods excel options (start_at='B1') ;
%report(in=a;title = ...) ;
ods excel options (start_at='A12') ;
%report(in=b,title ....) ;
%report(in=c,title ....) ;
%report(in=d,title ....) ;
ods excel options (start_at='B78') ;
%report(in=e,title ....) ;
ods excel options (start_at='A91') ;
%report(in=f,title ....) ;
%report(in=g,title ....) ;
Thanks
Depends on how formatted your tables are.
If it's a basic table, using PROC EXPORT is one method instead, where you can export to a specific range and specify the starting part of the range using Sheet1A1:0 where 0 allows the table to be dynamic in size.
But if you have formatting I'm not aware of an easy workaround at this time.
I don't think you'll be able to accomplish this with the START_AT option. From the documentation:
(START_AT='string')
specifies a starting cell for the report. The default is to start at column 1 and row 1.
Default 1,1 Tip This option cannot be changed in the middle of a sheet.
(emphasis added for the tip line above). That means the first start_at is where all the tables on that Excel sheet will start.
You may be able to generate something that looks like what you want by conditionally setting options in the PROC report to insert blank column(s) without left, top and bottom borders or any displayed content values for a column.
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.