BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jdub
Calcite | Level 5

Howdy

How would I output the results from a proc means to a SAS data set?  I know how to output out a mean of a collapsed variable but I also need to output out the standard deviation for each collapsed variable. 

Here is what I can do:

proc means data=digit;

by x;

var y;

output out=means mean=ybar;

run;

Is there a statement I could use to create a std dev for y?

I appreciate any help someone could give me.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

I'm not sure what you mean by collapsed variable but to add standard deviation to your output add

std= ystd after mean=ybar.

If you want to process more variables such as with :

var var1 var2 var3 ... ;

you could use

output out=<datasetname> mean= std= <other requested statistics> / autoname;

The autoname option will create variable names based on your variable name and the requested statistic so you don't have to.

View solution in original post

2 REPLIES 2
ballardw
Super User

I'm not sure what you mean by collapsed variable but to add standard deviation to your output add

std= ystd after mean=ybar.

If you want to process more variables such as with :

var var1 var2 var3 ... ;

you could use

output out=<datasetname> mean= std= <other requested statistics> / autoname;

The autoname option will create variable names based on your variable name and the requested statistic so you don't have to.

jdub
Calcite | Level 5

thank ya.

by collapsed obs I was trying to say that the mean of y was generated by x over a basket of time points but did a poor job of communicating this

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1531 views
  • 0 likes
  • 2 in conversation