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

While running proc means, the output is as follows: 

Capture.PNG

But while outputting the dataset using Output= statement, the format is completely different (Only one row with all stats of variables as variable names).

How can i get the output dataset in the same above format? (Need other stats as NMiss & Percentiles etc.)

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Use the STACKODSOUTPUT option, which was introduced in SAS 9.3:

 

/* Use the STACKODSOUTPUT option to get output in a more natural shape */
proc means data=sashelp.cars StackODSOutput 
           N NMISS MEAN STD P25 MEDIAN P75; 
var mpg_city mpg_highway;
ods output summary=out;
run;
 
proc print data=out noobs;run;

 

View solution in original post

3 REPLIES 3
ballardw
Super User

Do you need the data or a report table? If you want a readable table in the form you are showing then using ODS to output the table output would be the easiest thing.

 

Or transpose the output set

 

 

 

Phaneendra
Fluorite | Level 6

@ballardw: I need an output dataset in the same format as the report.(Variable Mean Min Max etc.)

 

Transposing the output has one row for each Statistic of the variable (Variable1_Mean, Variable1_Min etc.) but i want only one row for each variable and ststistics in columns (Same as report format).

Rick_SAS
SAS Super FREQ

Use the STACKODSOUTPUT option, which was introduced in SAS 9.3:

 

/* Use the STACKODSOUTPUT option to get output in a more natural shape */
proc means data=sashelp.cars StackODSOutput 
           N NMISS MEAN STD P25 MEDIAN P75; 
var mpg_city mpg_highway;
ods output summary=out;
run;
 
proc print data=out noobs;run;

 

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
  • 3 replies
  • 5535 views
  • 3 likes
  • 3 in conversation