BookmarkSubscribeRSS Feed
Alass006
Fluorite | Level 6

Hello there,

 

There is a statement in stat proc means that I am trying to find the equivalence in proc sql average.

If I want to compute the means and including missing values

proc means= data mean missing;

 var y;

output out=yout mean= Avg  std=SD;

run;

 

proc sql;

select *, avg(y)

from data;

quit.

Is there any way to include a missing statement in proc sql ?

Thanks in advance

 

 

 

 

3 REPLIES 3
art297
Opal | Level 21

Since proc mean's missing option only concerns missing class variables, there would be no difference in using sql's avg or proc means.

 

Art, CEO, AnalystFinder.com

 

Astounding
PROC Star

And on a related note, the sample PROC MEANS that you posted would produce the same results, whether or not the MISSING option is present.  You might need to see a few examples of how MISSING affects the results ... as @art297 mentioned, those examples will include a CLASS statement,.

 

Just curious, how are you picturing that the results would change if missing values are included vs. excluded?

Reeza
Super User

It's not clear how you want to include missing. If you essentially want them treated as 0, it's easiest to recode them and summarize on that, or you can use the sum() / COUNT() of the total number of rows, which would include the missing in the denominator. 

 


@Alass006 wrote:

Hello there,

 

There is a statement in stat proc means that I am trying to find the equivalence in proc sql average.

If I want to compute the means and including missing values

proc means= data mean missing;

 var y;

output out=yout mean= Avg  std=SD;

run;

 

proc sql;

select *, avg(y)

from data;

quit.

Is there any way to include a missing statement in proc sql ?

Thanks in advance

 

 

 

 


 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 30493 views
  • 0 likes
  • 4 in conversation