BookmarkSubscribeRSS Feed
bobeng
Obsidian | Level 7

HI I need hellp exporting multiple dataset outputs into one sheet in excel. I am using proc report to output my data.

 

 

2 REPLIES 2
PaigeMiller
Diamond | Level 26

You can direct SAS to output multiple reports to a single sheet in Excel via the ODS EXCEL option SHEET_INTERVAL='NONE'

 

Example:

ods excel file="c:\myfolder\myexcelfile.xlsx" options(sheet_interval='NONE');
proc report data=whatever;
...
run;
proc report data=whatever2;
...
run;
ods excel close;

 Please note: the column widths have to be the same as they are in one Excel sheet. For examplle, if the second column of the first table is wider than the second column of the second table, the Excel file makes the column wide enough for everything, even though that is too wide in the second table.

--
Paige Miller
Cynthia_sas
Diamond | Level 26

Hi:

  ODS EXCEL has a suboption called "sheet_interval" if you want multiple procedure steps (whether multiple PROC REPORTS or a mix of procedures), all you need to do is use the correct suboption. Here's an example:

Cynthia_sas_0-1620745772459.png

 

Cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2198 views
  • 2 likes
  • 3 in conversation