SAS - what is a good way to check if any of the variables are missing from the list?

I have data sets where sometimes I need to select observations, where none of the variables are listed.

ie I need to do this.

Where E1 NE . and E2 NE . and E3 NE . 

or I can make it a little easier:

 Where E1+E2+E3 NE . 

But is there any way in SAS to do something like:

 Where not missing(E1 - E3) 

It does not work if I do

 where sum(of E1-E3) NE . 

Since it is equivalent

 Where E1 NE . or E2 NE . or E3 NE . 

But I need "and" instead of "or".


I could also iterate over these variables in a dataset and build a variable for selection, for example:

 array E E1-E3; misind = 0; do i=1 to dim(E); if E(i) = . then misind = 1; end; 

But it is not so simple!

+5
source share
1 answer

I think you can use the nmiss or cmiss to check the exact number of columns with missing values.

for numeric columns. There is no column in e1-e3 missing.

 if nmiss(of e1-e3) = 0 

for numeric / char mixed columns. There is no column in e1-e3 missing.

 if cmiss(of e1-e3) = 0 
+9
source

Source: https://habr.com/ru/post/1208352/


All Articles