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:
| ID | date | Heigth | weight |
| 101 | 12/06/1993 | 159 | 67 |
| 101 | 10/08/1994 | 159 | 61 |
| 101 | 06/01/2000 | 159 | . |
| 102 | 08/08/2001 | 160 | 87 |
| 102 | 07/30/2002 | 160 | . |
| 102 | 11/03/2004 | 160 | 65 |
Please suggest some ideas to solve the given program.
Much Thanks!
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;
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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.