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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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