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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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