1
votes

In my dataset there are several observations (IDs) with all or too many missing variables. I want to know which IDs have no data (all variables are missing). I used proc freq but it gives me only freqency of variables, which do not serve my purpose. Proc mean nmiss also give me just total missing. I want to know exactly which IDs have missing variables. I searched online but couldn't locate solution of my problem. Help would be appreciated. Below is the sample data;

ID   a  b  c  d  e 
1    .  3  1  2  2
2    .  .  .  .  .
3    .  .  .  .  . 
4    3  .  5  .  .

I want result in a way that show me data of ID with complete missing information like;

ID  a  b  c  d  e
2   .  .  .  .  .
3   .  .  .  .  .

Thanks

Thanks in advance

2
You will get more help if you include a sample of your data and the output you are trying to achieve.Zfunk

2 Answers

2
votes

Use the nmiss function instead, which counts the number of missing values im the row for a specified list of variables. If you're looking at 3 variables for example

 If nmiss(var1, var2, var3) =3;
 Keep ID;

This will keep only records with all three variables missing.

0
votes

The n function returns the number of non-missing numeric values in a list. This means you could use a variable list and not worry about counting the variables:

if n(of _numeric_) = 0 then output;

or

if n(of a--e) = 0 then output;

If you're checking character variables, there is no corresponding c function, but you could use the coalescec function to do something similar. The coalesce functions return the first non-missing value from a list of values. To select rows with all character values missing, use something like:

if missing(coalescec(of _character_)) then output;