BookmarkSubscribeRSS Feed
mikestorm
Calcite | Level 5

Hello everyone.  I'm part of a group of folks at my organization who are just starting to migrate from BrioQuery to a SAS environment.  I state this to indicate that while we have very little SAS specific exposure, we aren't afraid of code per se.

That being said, I'm wondering how we would go about exporting SAS summary tables in excel format.    Some background.  Our reporting suite is primarily excel based, and to populate our reports, we've written some macros that clear out hidden tabs of a certain color, navigate to a separate extract staging area, and copy fresh extracts (that had been refreshed overnight to reflect prior day data) where the file names = tab names.  The extracts are basically summary tables (currently exports of Brio Pivot tables) where through the use of arrays, SUMIFs, SUMPRODUCTS, VLOOKUPs etc we're able to represent the data in our report shells in a fully automated fashion.

Brio Pivot tables almost perfectly resemble SAS Summary Tables, and if we were able to export unformatted summary tables in excel format (.xls or .xlsx) as a step in the project, that would clear a pretty large roadblock in our transition.  Obviously, the menu driven export functionality doesn't allow for this, so I'm hoping there's some sort of workaround via a bit of code that we can experiment with.   Any feedback would be greatly appreciated, and thanks in advance.

2 REPLIES 2
ChrisHemedinger
Community Manager

If you have SAS 9.4, you could try the new (experimental) ODS EXCEL destination, which would allow you to deposit your Summary Tables output (PROC TABULATE) into a spreadsheet.

See this blog post:

Experimenting with ODS EXCEL to create spreadsheets from SAS - The SAS Dummy

Example of PROC TABULATE output in Excel attached.

excel_ex.png

Generated by this code:

ods excel file="c:\temp\cars_tab.xlsx";
PROC TABULATE
DATA=SASHELP.CARS
   
    ;
   
   
VAR MPG_City MPG_Highway;
    CLASS Make / ORDER=UNFORMATTED MISSING;
   
CLASS Origin /   ORDER=UNFORMATTED MISSING;
   
TABLE /* Row Dimension */
Origin*
  Make*
    Mean={LABEL=
""},
/* Column Dimension */
MPG_City
MPG_Highway         ;
    ;

RUN;
ods excel close;

Chris

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Tom
Super User Tom
Super User

You can use PROC EXPORT to generate XLS files, no menu clicking is required.

I would recommend generating XLSX files if your downstream application can use them.

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

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 3919 views
  • 0 likes
  • 3 in conversation