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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1624 views
  • 0 likes
  • 2 in conversation