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;

SAS Innovate 2025: Register Now

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!

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
  • 1428 views
  • 1 like
  • 2 in conversation