Hi All,
I want to create variable with all the dates between the dates ranges.
for example
have:
id orddt recdt
100 1/5/15 2/3/15
100 1/17/15 3/6/15
......
....
101 ...............
101 ......
want;
1d orddt1 recdt1 dt1 dt2 orddt2 recdt2
100 1/5/15 2/3/15 1/5/15(first orddt)
100 1/5/15 2/3/15 1/6/15
100 1/5/15 2/3/15 1/7/15
100 1/5/15 2/3/15 1/8/15
...................
......................
100 1/5/15 2/3/15 1/17/15 1/17/15( 2nd orddt) 1/17/15 3/6/15
100 1/5/15 2/3/15 1/18/15(upto first recdt) 1/18/15 1/17/15 3/6/15
........................
....................
100 1/5/15 2/3/15 2/2/15
100 1/5/15 2/3/15 2/3/15
100 2/4/15 1/17/15 3/6/15
100 2/5/15 1/17/15 3/6/15
............................
..............................
..............................
100 3/6/15(2nd recdt) 1/17/15 3/6/15
my code:
data want;
set have;
by id;
array d[&max] dt1-dt&max.;
do i=1 to &max;
do dt=orddt to recdt;
d[i]=dt;
output;
end;
end;
format dt-dt&max. date9.;
run;
i am missing some thing in my code.
Thanks
Sam
Same , orddt to recdt
Thanks
Sam
Thanks Reeza!!! . I tried the way you suggested, but doesnt work!!! i created a order variable!! still not able to get what i want
Any suggestion will be helpful
Thanks
Sam
Post your code and define doesn't work.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.