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=''] ...

Get PROC TABULATE by Example, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.