Skip to Main Content
PROC TABULATE by Example, Second Edition
book

PROC TABULATE by Example, Second Edition

by Lauren Haworth Lake, Julie McKnight
May 2015
Intermediate to advanced content levelIntermediate to advanced
348 pages
11h 31m
English
SAS Institute
Content preview from PROC TABULATE by Example, Second Edition

Export Tables to a Spreadsheet

It is pretty simple to get your tables into Excel with ODS. You use an ODS destination statement the same way we did in Create Printable Output. You specify the ODS EXCEL destination statement in the ODS "sandwich" as follows:
ODS EXCEL FILE="your-file.xlsx";

         ...PROC TABULATE program here ...

ODS EXCEL CLOSE;
When you add in your PROC TABULATE program, the complete code looks like this:
ODS EXCEL FILE="MULTITABLEFINAL.XLSX"; TITLE "Historical Sales Data"; PROC TABULATE DATA=PRDSALE; BY COUNTRY; VAR PREDICT ACTUAL; CLASS REGION DIVISION PRODTYPE YEAR; TABLE YEAR=[LABEL=' '], REGION*(DIVISION*PRODTYPE ALL=[LABEL='DIVISION TOTAL']) ALL=[LABEL='GRAND TOTAL'], PREDICT=[LABEL='TOTAL PREDICTED SALES']*F=DOLLAR10.*SUM=[LABEL=''] ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

SAS 9.4 Language Reference, 6th Edition

SAS 9.4 Language Reference, 6th Edition

SAS Institute

Publisher Resources

ISBN: 9781607649908