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
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
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?
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
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.
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.