Hello all,
many thanks to help me to convert the first design to the second design?
Id B w g
1 10 . .
1 . 8 .
1 . . 6
2 12 . .
2 . 15 .
2 . . 17
.
.
.
second design:
Id B w g
1 10 8 6
2 12 15 17
3
.
.
.
Thanks,
Assuming you want the last non-missing value for each variable in the group just use the UPDATE statement. That requires two datasets, the original data and the transactions to be applied. But you can use your existing dataset in both places. Just start with zero observations.
data want;
update have(obs=0) have;
by id;
run;
Assuming you want the last non-missing value for each variable in the group just use the UPDATE statement. That requires two datasets, the original data and the transactions to be applied. But you can use your existing dataset in both places. Just start with zero observations.
data want;
update have(obs=0) have;
by id;
run;
Thanks so much, that's an easy way.
proc summary data=have nway;
class id;
var b w g;
output out=want sum=;
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!
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.