BookmarkSubscribeRSS Feed
Noob
Fluorite | Level 6

Hello,

 

I am using proc means and would like to create a SAS dataset that is exactly the same as the one that appears in the HTML output window. In the past I have been able to pull the table by using a 'ods output' statement within other SAS procedures. In this case it didn't work exactly as planned and I am left with a few questions:

 

1) When SAS creates the tables for the HTML output, is that dataset already temporarily saved in some physical location? ODS trace says the path is Means.ByGroup1.Summary. However, this isn't quite helpful to me. Is there a full path so I can navigate to that file?

 

2) If I want to create a separate table for each 'by' group, how do I do this? It seems to me that each table has the same name (Summary). Is there a way I can use the path name to differentiate?

 

3) Why is it that when I save the table using the code below, the table is formatted differently. I.e. rows and columns have been switched?

 

ods trace on;

proc means data=h.combined mean median min max var;

by clinic;

ods output summary=summary;

run;

 

Output Added:

-------------

Name: Summary

Label: Summary statistics

Template: base.summary

Path: Means.ByGroup1.Summary

-------------

NOTE: The above message was for the following BY group:

clinic=AMR

Output Added:

-------------

Name: Summary

Label: Summary statistics

Template: base.summary

Path: Means.ByGroup2.Summary

 

2 REPLIES 2
Reeza
Super User

Add the STACKODS option in your proc means statement.

I don't think you can get separate tables for your BY statements, in general that's not a good idea anyways.

 

http://support.sas.com/kb/46/427.html

 

http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p17h6q7ygvkl1sn13qzf9...

 

 

Noob
Fluorite | Level 6

Thanks, that is a helpful option!

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