Hi,
Below is a table with matched dataset (cases and controls). Out of the five cases, first four cases have a duplicate case with missing values for all variables. How can I delete these row?
Thanks
Group | Type | Control Id | id | age | edu | race | parity | wt | ht | opwo | fev |
1 | Case | . | . | . | . | . | . | . | . | . | . |
1 | Case | . | 5 | 32 | 9 | 1 | 0 | 90 | 5.2 | 1 | 1 |
1 | Control | 1 | 70 | 32 | 9 | 1 | 0 | 90 | 5.2 | 1 | 0 |
1 | Control | 2 | 99 | 35 | 10 | 1 | 0 | 90 | 5.2 | 0 | 0 |
2 | Case | . | . | . | . | . | . | . | . | . | . |
2 | Case | . | 12 | 35 | 12 | 1 | 2 | 110 | 5 | 0 | 1 |
2 | Control | 1 | 43 | 35 | 12 | 1 | 1 | 110 | 5 | 0 | 0 |
2 | Control | 2 | 101 | 33 | 11 | 1 | 2 | 110 | 5 | 0 | 0 |
3 | Case | . | . | . | . | . | . | . | . | . | . |
3 | Case | . | 22 | 25 | 14 | 3 | 0 | 110 | 5.4 | 0 | 1 |
3 | Control | 1 | 125 | 25 | 13 | 3 | 0 | 110 | 5.4 | 0 | 0 |
3 | Control | 2 | 51 | 28 | 12 | 3 | 0 | 110 | 5.4 | 0 | 0 |
4 | Case | . | . | . | . | . | . | . | . | . | . |
4 | Case | . | 29 | 27 | 12 | 2 | 1 | 95 | 5 | 1 | 1 |
4 | Control | 1 | 32 | 29 | 12 | 2 | 2 | 125 | 6.2 | 1 | 0 |
4 | Control | 2 | 31 | 27 | 10 | 2 | 1 | 95 | 5.5 | 0 | 0 |
5 | Case | . | 40 | 28 | 10 | 3 | 2 | 130 | 6 | 1 | 1 |
5 | Control | 1 | 58 | 28 | 10 | 3 | 2 | 130 | 6 | 0 | 0 |
5 | Control | 2 | 93 | 27 | 11 | 3 | 2 | 130 | 6 | 1 | 0 |
data want;
set have;
where id is not missing;
run;
Hi PGStat,
I understand the code will keep thosr rows which do not have missing values. In that scenario, my all cases have first column with missing value. I am afraid it will delete that caso also and this way my all cases would be lost. Please guide me.
Thanks
if cmiss(ControlId,id,age,edu,race,parity,wt,ht,opwo,fev)= 10 then delete;
Hi Ksharp,
Please confirm 10 represents the number of variables in the parentheses.
thanks
Yes. Confirm. I thought you know function CMISS() , didn't you ?
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.