BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sniekp
Calcite | Level 5
I haven't been working with SAS for very long and I'm really struggling with the following problem. (SAS enterprise guide 7.1)
I have a table named CONTROLE
select * from CONTROLE
gives the following result (all numeric)

CONTROLE | BEGIN | END
17135           | 40        | 45 

17136           | 46        | 48

 

I want to transform this into

CONTROLE | RANGE

17135           | 40

17135           | 41      

17135           | 42

17135           | 43

17135           | 44

17135           | 45

17136           | 46

17136           | 47

17136           | 48

 

is there a simple solution?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Yes, there is 😉

A simple data step DO loop will do it:

data have;
input CONTROLE $ BEGIN END;
datalines;
17135 40 45 
17136 46 48
;

data want;
set have;
do range = begin to end;
  output;
end;
keep controle range;
run;

View solution in original post

1 REPLY 1
Kurt_Bremser
Super User

Yes, there is 😉

A simple data step DO loop will do it:

data have;
input CONTROLE $ BEGIN END;
datalines;
17135 40 45 
17136 46 48
;

data want;
set have;
do range = begin to end;
  output;
end;
keep controle range;
run;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1718 views
  • 1 like
  • 2 in conversation