I have datasets where I sometimes need to select observations where none of the variables in the list are missing.
i.e I have to do this.
Where E1 NE . and E2 NE . and E3 NE .
or I can do it little bit more easily like this:
Where E1+E2+E3 NE .
But is there any way in SAS to do something like:
Where not missing(E1 - E3)
It doesn't work if I do
where sum(of E1-E3) NE .
Because that is equivalent to
Where E1 NE . or E2 NE . or E3 NE .
But i need "and" instead of "or".
I could also loop over those variables in a dataset and build a variable for the selection like:
array E E1-E3;
misind = 0;
do i=1 to dim(E);
if E(i) = . then misind = 1;
end;
But that's not so simple either!
I think you may use function nmiss
or cmiss
to check the exact number of columns with missing values.
for numerical columns. No column in e1-e3 is missing.
if nmiss(of e1-e3) = 0
for numerical/char mixed columns. No column in e1-e3 is missing.
if cmiss(of e1-e3) = 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With