BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
FarazA_Qureshi
Calcite | Level 5

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.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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*/

View solution in original post

2 REPLIES 2
ballardw
Super User

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*/

FarazA_Qureshi
Calcite | Level 5

Thanx Ballard!
Sure do appreciate your explanation!

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

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
  • 463 views
  • 0 likes
  • 2 in conversation