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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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