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;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 575 views
  • 0 likes
  • 2 in conversation