Hi All,
i have the following data, for every on record i need to create two records with stdy and endy values populated under col1 and values in res must be populated under res1 as follows
any suggestions?
This is what i have
sub stdy endy res
111 1 7 10
111 8 10 20
111 11 13 20
111 15 20 40
222 12 17 70
222 18 30 70
the final output
sub col1 res1
111 1 10
111 7 10
111 8 20
111 10 20
111 11 20
111 13 20
111 15 40
111 20 40
222 12 70
222 17 70
222 18 70
222 30 70
Thanks
data want;
set have;
col1=stdy;
output;
col1=endy;
output;
keep sub col1 res;
run;
data have;
input sub stdy endy res;
cards;
111 1 7 10
111 8 10 20
111 11 13 20
111 15 20 40
222 12 17 70
222 18 30 70
;
data want;
set have;
do col1=stdy,endy;
output;
end;
drop stdy endy;
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.