At the end of a lengthy collection Macros and Procedures when I end the same with the following code:
PROC TABULATE DATA=RESULTS2 OUT=CHK2;
CLASS PRODUCT DPD_BUCKET DATA_MONTH;
VAR TOTAL_OS COUNT_OS;
TABLE PRODUCT, DPD_BUCKET, TOTAL_OS*DATA_MONTH;
RUN;
It presents an excellent Cross Tabulated Pivot Like format in OutPut Window. however, when I select and run only this last piece of code after clearing up the Output Window and Log with F12 the table never appears again:
ods tagsets.excelxp file="ExcelResultsA.xls";
proc PRINT data=RESULTS;
run; quit;
ods _all_ close;
Any particular reason?
Furthermore, how to export such an appearing table in the similar Pivot like manner in Excel via ODS?
Thanx in advance.
Do you want the cross tab appearance, then run proc tabulate.
Proc print as shown is referencing the input to tabulate and print only knows rows, no nesting or crossing. You may have meant to try to print the output data set CHK2 but it would still not be the cross tab output.
you probably want
ods tagsets.excelxp file="ExcelResultsA.xls";
PROC TABULATE DATA=RESULTS2 OUT=CHK2;
CLASS PRODUCT DPD_BUCKET DATA_MONTH;
VAR TOTAL_OS COUNT_OS;
TABLE PRODUCT, DPD_BUCKET, TOTAL_OS*DATA_MONTH;
RUN;
ods tagsets.excelxp close; /* the _all_ close sometimes causes problems as no output destinations are open after runing the first time*/
Do you want the cross tab appearance, then run proc tabulate.
Proc print as shown is referencing the input to tabulate and print only knows rows, no nesting or crossing. You may have meant to try to print the output data set CHK2 but it would still not be the cross tab output.
you probably want
ods tagsets.excelxp file="ExcelResultsA.xls";
PROC TABULATE DATA=RESULTS2 OUT=CHK2;
CLASS PRODUCT DPD_BUCKET DATA_MONTH;
VAR TOTAL_OS COUNT_OS;
TABLE PRODUCT, DPD_BUCKET, TOTAL_OS*DATA_MONTH;
RUN;
ods tagsets.excelxp close; /* the _all_ close sometimes causes problems as no output destinations are open after runing the first time*/
Thanx Ballard!
Sure do appreciate your explanation!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.