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

proc means data=OSCE_Neph nway nmiss mean std skew Median;

class Station SP_MD;

var Q1resp Q2Resp Q3Resp Q4Resp Q5Resp Q6Resp;

output out = StationsData mean= std= skew= Median=;

run;

How can i get the Mean Std Skew Median of the responses in the final data set? Also in stationsdata i get _type_ as 3 in the rows. Why is that?

Thanks,

Thomas

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

Thomas,

To get what you want add the autoname option.

You are getting type=3 because you used the nway option which is giving you only the highest level breakdown, which I presume is what you want.  You can eliminate that from your output file with a drop statement.  e.g.:

proc means data=OSCE_Neph

      nway nmiss mean std skew Median noprint;

  class Station SP_MD;

  var Q1resp Q2Resp Q3Resp Q4Resp Q5Resp Q6Resp;

  output out = StationsData (drop=_:)

         mean= std= skew= Median= /autoname;

run;

View solution in original post

4 REPLIES 4
art297
Opal | Level 21

Thomas,

To get what you want add the autoname option.

You are getting type=3 because you used the nway option which is giving you only the highest level breakdown, which I presume is what you want.  You can eliminate that from your output file with a drop statement.  e.g.:

proc means data=OSCE_Neph

      nway nmiss mean std skew Median noprint;

  class Station SP_MD;

  var Q1resp Q2Resp Q3Resp Q4Resp Q5Resp Q6Resp;

  output out = StationsData (drop=_:)

         mean= std= skew= Median= /autoname;

run;

ThomasGeorge
Calcite | Level 5

Thanks a lot art. I appreciate it. It worked. But i have a question. Will the proc step give me an overall means? Cos right i get the means of each question. Can i get the means of all the stations in the proc step? Or do i have to write another data step for that.

Thanks much.

art297
Opal | Level 21

Remove the nway and drop options.  That way you will get all of the combinations specified in your class statement.

Ksharp
Super User

proc sql;

select mean(mean(Q1resp,Q2Resp,Q3Resp,Q4Resp,Q5Resp,Q6Resp)) as grand_mean

  from OSCE_Neph ;

quit;

Ksharp

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1530 views
  • 2 likes
  • 3 in conversation