BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bemariec
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
bemariec
Obsidian | Level 7

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

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
bemariec
Obsidian | Level 7

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
Obsidian | Level 7
I found it! N is excluded EXCEPT for n and nmiss in proc tabulate! thank you!
PaigeMiller
Diamond | Level 26

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

--
Paige Miller
bemariec
Obsidian | Level 7
Sorry! yess! Missing values are excluded Except for n ans nmiss, where missing values are included
ballardw
Super User

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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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