BookmarkSubscribeRSS Feed
cgsmoak56
Calcite | Level 5

Hi,

I am trying to figure out how to use ODS Excel and two PROC REPORTs to write to the same worksheet.  For example,


ods excel file='C:\temp\test.xlsx'

options(sheet_name="dsn" sheet_interval='TABLE' gridlines='ON' flow='DATA');

proc report data=dsn1 nowd
columns VarA VarB VarC;

.

.

Define statements

proc report data=dsn2 nowd
columns VarD VarE Var F;

.

.

Define statements

 

Note that the first PROC REPORT uses a dataset called dsn1 and the second PROC REPORT uses a dataset called dsn2.  Ideally, I would like for the PROC REPORT using dsn2 to start at row 60 on the worksheet.

 

2 REPLIES 2
PaigeMiller
Diamond | Level 26

If you remove SHEET_INTERVAL='TABLE', your code should work, both PROC REPORT outputs should go in the same worksheet, but you can't control which line it starts on.

--
Paige Miller
cgsmoak56
Calcite | Level 5
That works, but I have a macro that loops through to create one spreadsheet per topic. So, when I remove the sheet_interval, it puts all of the topics into one spreadsheet. But I think that I have some ideas that I can try out to solve the problem. Thank you for your assistance.

SAS Innovate 2025: Call for Content

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 851 views
  • 0 likes
  • 2 in conversation