BookmarkSubscribeRSS Feed
Aexor
Lapis Lazuli | Level 10

Hello Everyone!

 

Please help me to understand when to use Proc Summary and when we can use PROC Means.

 

I know basic  difference between these do.

 

I just wanted to comparison based on there usages. Which is better and when?

 

thanks! 

5 REPLIES 5
PaigeMiller
Diamond | Level 26

There are very few important differences between PROC MEANS and PROC SUMMARY.

 

Off the top of my head, the major difference is that PROC SUMMARY default is to produce an output data set, while PROC MEANS by default writes the results to an output destination (HTML, Listing, etc.) and not to a data set. These defaults can be overridden.

--
Paige Miller
Aexor
Lapis Lazuli | Level 10
Thanks! yes I Know they are similar yet different. but I actually wanted to understand that in which particular situation we can trust PROC MEANS over PROC summary or vice versa
PaigeMiller
Diamond | Level 26

You can trust either one of them. The reason to prefer one over the other is purely personal preference.

--
Paige Miller
Reeza
Super User
It's not a matter of trust. Both will generate correct statistics, it's a matter of which is appropriate for you and what you need.

Usually that has to do with the statistics they generate and the format/display but not the actual values generated. The usual only case where PROC MEANS/SUMMARY are 'untrusted' are when you have survey weights. In that case, you need to use SURVEYMEANS not PROC MEANS.
ballardw
Super User

@PaigeMiller wrote:

There are very few important differences between PROC MEANS and PROC SUMMARY.

 

Off the top of my head, the major difference is that PROC SUMMARY default is to produce an output data set, while PROC MEANS by default writes the results to an output destination (HTML, Listing, etc.) and not to a data set. These defaults can be overridden.


The default structure of data sets created with the OUTPUT statement is slightly different between Proc Means and Proc Summary. While Proc Summary will create "print" output you have to specify the Print option and provide a var statement with the variables to include. Proc means by default will summarize all numeric variables if no VAR statement is provided.

 

Ancient history: as late as SAS 5 Proc Means would not create a data set and Proc Summary was needed for that. Proc Summary only created data sets and no "print" output.

 

SAS doesn't routinely make changes to "core" procedures like Means and Summary that would break existing code so both will now create data sets or print output but have minor differences in how it is accomplished for each procedure.

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 758 views
  • 1 like
  • 4 in conversation