SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lydiawawa
Lapis Lazuli | Level 10

Hi,

 

I'm trying to output population standard deviation , not just standard deviation. On SQL, it is simple as using the std_pop. Is there anyway on SAS that I can turn the keys on proc univariate and proc means?

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @lydiawawa,

 

You can also use the VARDEF=N option of PROC MEANS (same in PROC UNIVARIATE) to switch from sample to population standard deviation.

View solution in original post

9 REPLIES 9
PaigeMiller
Diamond | Level 26

I think you you have to run PROC MEANS and create an output data set, then in a DATA step you take the outputs from PROC MEANS and then multiply by the proper factor to convert it to the population standard deviation.

--
Paige Miller
lydiawawa
Lapis Lazuli | Level 10
How do you convert the sum function with multiple layers of groups?
PaigeMiller
Diamond | Level 26

@lydiawawa wrote:
How do you convert the sum function with multiple layers of groups?

Is this related to your first question? Can you provide more explanation of what you are asking?

--
Paige Miller
lydiawawa
Lapis Lazuli | Level 10

If I want to compute pop standard deviation of supposedly college admission rate among counties by state. How should I convert mean to population standard deviation ?

 

State      County      College Admission Rate

MA           01                    0.7

MA           03                    0.5

VA            02                    0.3

VA            05                    0.4                   

VA            07                    0.6

 

 

Mean:

State      College Admission Rate

MA                      0.6           

VA                       0.43

 

How do I convert the sum function and derive the pop std manually?

PaigeMiller
Diamond | Level 26

I'm afraid I don't understand. You keep jumping from standard deviation to mean and back. Please explain in more detail.

--
Paige Miller
lydiawawa
Lapis Lazuli | Level 10
You told me that to get to pop standard deviation is by calculating the mean first, then manually compute the pop std? If you check the formula for pop standard deviation there is a sum function you need to use after you get the mean. How do I get to pop standard deviation after I get the mean? I do not know how to convert the sum function into SAS program, and I have provided the data structure in my previous response.
PaigeMiller
Diamond | Level 26

When I spoke about using PROC MEANS, it was to get a sample standard deviation. Then you can multiply the sample standard deviation by the proper factor to get the population standard deviation. You don't need to do anything manually here (other than write the proper code) and you don't specifically need to compute the mean and then use it, because PROC MEANS does that internally.

--
Paige Miller
FreelanceReinh
Jade | Level 19

Hi @lydiawawa,

 

You can also use the VARDEF=N option of PROC MEANS (same in PROC UNIVARIATE) to switch from sample to population standard deviation.

PaigeMiller
Diamond | Level 26

@FreelanceReinh wrote:

 

You can also use the VARDEF=N option of PROC MEANS (same in PROC UNIVARIATE) to switch from sample to population standard deviation.


I forgot about that. Definitely a better solution than what I was suggesting.

--
Paige Miller

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 9 replies
  • 3812 views
  • 5 likes
  • 3 in conversation