Hi,
I have a BP data where some of the id have missing data. I want to delete only those rows where both the values(SBP and DBP) are missing.
My data look like this
data have ;
id date SBP DBP
1 1/1/2011 122 84
1 2/1/2011 . .
1 3/1/2011 120 82
1 4/1/2011 . 86
2 1/1/2011 110 76
2 2/1/2011 146 88
2 3/1/2011 140 .
2 4/1/2011 . .
3 1/1/2011 124 80
3 2/1/2011 . 88
3 3/1/2011 130 90
I want data like this
data want
id date SBP DBP
1 1/1/2011 122 84
1 3/1/2011 120 82
1 4/1/2011 . 86
2 1/1/2011 110 76
2 2/1/2011 146 88
2 3/1/2011 140 .
3 1/1/2011 124 80
3 2/1/2011 . 88
3 3/1/2011 130 90
;
Kindly suggest
Thanks in advance.
data want;
set have;
where coalesce(SBP,DBP)>.;
run;
data want;
set have;
if not missing(SBP) and not missing(DBP);
run;
Thanks or the reply.
This command deletes all the rows which have any of the missing values.
data want;
set have;
where coalesce(SBP,DBP)>.;
run;
Thanks it worked
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.