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?
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;
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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.