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.
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!
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.