BookmarkSubscribeRSS Feed

Distinguishing PROC MEANS, SUMMARY, TABULATE

Started ‎09-02-2022 by
Modified ‎09-02-2022 by
Views 3,546

PROC MEANS computes descriptive statistics

  • for variables across all observations and within groups of observations
  • estimates quantiles, which includes the median
  • calculates confidence limits for the mean
  • identifies extreme values and performs a t test
  • places its result into your output window

PROC SUMMARY is the same as PROC MEANS, howeverits results are written to an output dataset.

 

PROC TABULATE elaborates on PROC MEANS/SUMMARY - displays descriptive statistics in tabular format.

  • places its result into your output window and/or output dataset
  • use some or all of the variables in a data set
  • flexibility in classifying the values of variables and establishing hierarchical relationships between them
  • label and format variables and procedure-generated statistics
  • On SAS Viya, all 3 procedures use CAS actions when processing CAS tables

Where are PROC MEANS, SUMMARY, TABULATE tasks in SAS Enterprise Guide?

megak8_0-1661968503079.png

PROC MEANS (and PROC SORT & UNIVARIATE)

View -> Tasks -> Describe -> Summary Statistics / Summary Statistics Wizard

PROC SUMMARY is not generated by SAS Enterprise Guide - use code

 

PROC TABULATE 

View -> Tasks -> Describe -> Summary Tables / Summary Tables Wizard

 

Where are PROC MEANS, SUMMARY, TABULATE tasks in SAS Studio?

 

PROC MEANS

Tasks -> Statistics -> Summary Statistics

 megak8_0-1661969394589.png

 

PROC SUMMARY & PROC TABULATE

Not generated by SAS Studio at this time of this article's publication - use code

 

Examples

Here is some code that you can run using fictitious data included with all SAS installations:

proc means data=sashelp.cars;
  var msrp invoice;
run;
proc summary data=sashelp.cars;
  var msrp invoice;
  OUTPUT out=WORK.summaryout 
(LABEL="PROC SUMMARY Output Table for SASHELP.CARS"); run;
PROC TABULATE
	DATA=SASHELP.CARS
	OUT=WORK.tabulateout 
(LABEL="PROC TABULATE Output Table for SASHELP.CARS") FORMAT=comma10.2; VAR Weight Wheelbase; CLASS Type / ORDER=freq MISSING; TABLE /* Row Dimension */ Type, /* Column Dimension */ N Weight * Range Wheelbase * Mean; ; RUN; QUIT;
 

Adding PROC FORMAT can enhance your PROC TABULATE results; here color is emphasized:

PROC FORMAT;
	VALUE watchit
		0 - 20000 = 'Green'
		20001 - 30000 = 'Orange'
		30001 - 50000 = 'Blue'
		50001 - 60000 = 'Purple'
		60001 - high = 'Red';
RUN;

PROC TABULATE data=sashelp.cars S=[foreground=watchit.]
	FORMAT=dollar10.2
	OUT=WORK.tabulatecolor 
	(LABEL="PROC TABULATE Output Table for SASHELP.CARS");
	CLASS type cylinders / MISSING;
	VAR invoice;

	TABLE type ALL,
		Invoice * mean;
RUN;

Conclusion

PROC MEANS, SUMMARY, TABULATE are similar in terms of the descriptive statistics that they generate, yet they are also different because of their outputs. Because PROC TABULATE gives you the most control, its versatility may be the best fit for most scenarios. 

Version history
Last update:
‎09-02-2022 12:51 PM
Updated by:
Contributors

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!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags