Sentry Page Protection
Proc Means [2-3]
SAS Base Exam
SAS Base Exam
Specifying Statistics
By default, the MEANS procedure computes the n, mean, standard deviation, minimum and maximum.
What if you need other statistics such as median, mode or quantiles?
Simply add the statistics options to the MEANS procedure to request the statistics you need.
Example
Copy and run the INTERNET data set from the yellow box below.
Let's supposed we need the mean, standard deviation, Q1 (lower quantile) and Q3 (upper quantile) only.
Example
Proc Means Data=Internet Mean Std Q1 Q3;
Var Chrome;
Run;
The mean, standard deviation, Q1 and Q3 statistics are specified in the MEANS procedure:
This will generate a table with only the statistics being requested:
Specifying Decimal Places
By default, the MEANS procedure displays 7 decimal places:
Sometimes, you might want to display the values at different decimal places.
Simply add the MAXDEC= option to the MEANS procedure to control the decimal places to display.
Example
Proc means Data=Internet Maxdec=2;
Var Chrome;
Run;
The Maxdec=2 displays the statistics in 2 decimal places:
Exercise
Write a SAS program and compute the Q1, Median and Q3 of the FIREFOX variable from the INTERNET data set.
Display the statistics in 3 decimal places.
Display the statistics in 3 decimal places.
Need some help?
Fill out my online form.