BookmarkSubscribeRSS Feed
elsfy
Quartz | Level 8

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

4 REPLIES 4
Reeza
Super User
Unfortunately you cannot change START_AT yet using ODS EXCEL in the method you're expecting here.
Hopefully that's something they update soon.
elsfy
Quartz | Level 8
Thank you for your answer.
Is there an alternative ?
Reeza
Super User

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. 

ballardw
Super User

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.

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 993 views
  • 3 likes
  • 3 in conversation