BookmarkSubscribeRSS Feed
Almoha
Calcite | Level 5

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

 

2 REPLIES 2
PaigeMiller
Diamond | Level 26
data want;
    set have;
    col1=stdy;
    output;
    col1=endy;
    output;
    keep sub col1 res;
run;
--
Paige Miller
novinosrin
Tourmaline | Level 20
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;

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 516 views
  • 1 like
  • 3 in conversation