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 Innovate 2025: Call for Content! Submit your proposals before Sept 16. Accepted presenters get amazing perks to attend the conference!
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.

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

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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