BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sathish_jammy
Lapis Lazuli | Level 10

Dear Experts,

 

I want to update the missing Height value in my table for the given IDs

Kindly go through my sample set for detail.

 

data have;
input ID date mmddyy10. Heigth weight;
format date mmddyy10.;
cards;
101 12/06/1993 159 67
101 10/08/1994 . 61
101 06/01/2000 . .
102 08/08/2001 . 87
102 07/30/2002 160 .
102 11/03/2004 . 65
;

Expected Result:

IDdateHeigthweight
10112/06/199315967
10110/08/199415961
10106/01/2000159.
10208/08/200116087
10207/30/2002160.
10211/03/200416065

 

Please suggest some ideas to solve the given program.

Much Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
TarunKumar
Pyrite | Level 9

data have;
input ID date mmddyy10. Heigth weight;
format date mmddyy10.;
cards;
101 12/06/1993 159 67
101 10/08/1994 . 61
101 06/01/2000 . .
102 08/08/2001 . 87
102 07/30/2002 160 .
102 11/03/2004 . 65
;
run;

data have_1;
set have (where=(Heigth ne .));
keep id Heigth;
run;

proc sort data=have;by id;run;
proc sort data=have_1;by id;run;

data want;
merge have(in=aa drop=Heigth) have_1(in=aa);
by id;
if aa=1;
run;

View solution in original post

1 REPLY 1
TarunKumar
Pyrite | Level 9

data have;
input ID date mmddyy10. Heigth weight;
format date mmddyy10.;
cards;
101 12/06/1993 159 67
101 10/08/1994 . 61
101 06/01/2000 . .
102 08/08/2001 . 87
102 07/30/2002 160 .
102 11/03/2004 . 65
;
run;

data have_1;
set have (where=(Heigth ne .));
keep id Heigth;
run;

proc sort data=have;by id;run;
proc sort data=have_1;by id;run;

data want;
merge have(in=aa drop=Heigth) have_1(in=aa);
by id;
if aa=1;
run;

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 1 reply
  • 354 views
  • 0 likes
  • 2 in conversation