Hi!
I'm trying to make a PROC TABULATE for a big amount of observations (60 000), and there are few missing values for some variables... I want to exclude these missing values from the stats I calculate, but I don't want to delete de rows! Some observations can be used for one variable and not the other... (n=6500 instead of 6480 (there are 20 missing values))
Code:
proc tabulate data=Recyc.aqhc_cc;
class groupe_enrobe Calibre R;
var ecart_Ta_5 ecart_Ta_080 ecart_TG ecart_PourBitume;
table (groupe_enrobe)*(calibre),(R All)*(n) (R All)*(ecart_Ta_5 ecart_Ta_080 ecart_TG ecart_PourBitume)*(std);
run;
I want n to be counted without missing values of variables... Same for std...
Thanks for your help!!! 🙂
Marie-Christine
Hi! thanks for the quick answer!
I thought the same, but when I did the proc capability statement, I found different n ans std... So I investigated, and I found 17 missing values (with proc means) for a particular variable and class... the "n" was not the right one in proc tabulate... 😕
As far as I know, PROC TABULATE does not include missings in its statistics, and furthermore the missing are not included in the calculation of N.
So as far as I can see, you don't need to do anything different.
Hi! thanks for the quick answer!
I thought the same, but when I did the proc capability statement, I found different n ans std... So I investigated, and I found 17 missing values (with proc means) for a particular variable and class... the "n" was not the right one in proc tabulate... 😕
@bemariec wrote:
I found it! N is excluded EXCEPT for n and nmiss in proc tabulate! thank you!
I'm sorry but I don't understand this statement.
Do you mean that missing values are excluded?
@bemariec wrote:
Sorry! yess! Missing values are excluded Except for n ans nmiss, where missing values are included
I think you need to say something about which specific variables you are discussing as CLASS variables with missing values are excluded:
data junk; input x; datalines; . 1 1 1 . 3 3 3 3 2 ; run; proc tabulate data=junk; class x; table x all,n; run;
10 obs in, 8 reported on.
Tabulate by default will exclude all rows with ANY of the class variables missing.
So when you look at individual variables such as with proc means or freq the class variables values will ALL show.
data junk; input x y; datalines; . 1 1 2 1 3 1 . . 5 3 1 3 1 3 . 3 1 2 1 ; run; proc tabulate data=junk; class x Y; table x *y,n; run; proc means data=junk n; var x y; run;
Tabulate: 6 records, Means 8 values for each of x and y.
So you might want to consider providing some example data and what the desired result is.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: