SAS Procedures

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

newvariablename = mean (var1, var2, var3, var4, var5, var6) is there anything I can add to this code to require at least 3 values in this mean? (i.e. if a participant has lots of missing data, I don't get a mean when they only submitted 1 answer out of 6).

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
if n(of var1-var6)>2 then newVariableName = mean(of var1-var6);

View solution in original post

3 REPLIES 3
Reeza
Super User
if n(of var1-var6)>2 then newVariableName = mean(of var1-var6);
Astounding
PROC Star

if n(of var1-var6) > 2 then newvariablename = mean(of var1-var6);

 

 

 

And posted within 4 seconds of one another!

ballardw
Super User

Question: Your comment of  "when they only submitted 1 answer out of 6" raises the question of what kind of responses are these and is a mean really appropriate. If your responses are actually numeric values like a measure or dollar amount that is appropriate. If responses are numeric codes from an agreement scale I suggest caution.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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
  • 3 replies
  • 817 views
  • 7 likes
  • 4 in conversation