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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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