BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mehul4frnds
Obsidian | Level 7

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.

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20
data want;
set have;
where coalesce(SBP,DBP)>.;
run;

View solution in original post

4 REPLIES 4
ballardw
Super User

data want;

    set have;

    if not missing(SBP) and not missing(DBP);

run;

mehul4frnds
Obsidian | Level 7

Thanks or the reply.

This command deletes all the rows which have any of the missing values.

novinosrin
Tourmaline | Level 20
data want;
set have;
where coalesce(SBP,DBP)>.;
run;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 980 views
  • 0 likes
  • 3 in conversation