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!
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.
You can trust either one of them. The reason to prefer one over the other is purely personal preference.
@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.
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!
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.