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;
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!
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.