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 ?
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.