DATA Step, Macro, Functions and more

Looking for a way to assign "days" between two dates with no date value

Reply
Frequent Contributor
Posts: 78

Looking for a way to assign "days" between two dates with no date value

The subject couldn't describe what I need accurately so here is more detail:

I have start of the week dates and and end date that allows me to calculate days between the two dates using:

array weekd{32} weekdate_wk1-weekdate_wk32;
array daysweek{32} daysweek1-daysweek32;

do i=1 to 32;
daysweek{i}=intck('days',weekd{i},enddate);
end;

This is simple enough. The weekdate is always the date on Sunday for each week (wk1day1_value). So, now I need to calculate the days for each variable for each day of the week (these are not date variables) for the following variables:

wk1day1_value-wk32day7_value (with values for each day of the week, for 32 weeks.)

My thought was to do an array for each day of the week for each week and add the number of days from the calculated days for each week (day1 for weeks 1-32 +0, day 2 for weeks 1-32 +1, day3 for weeks 1-32 +2, etc).

Does anyone know an easier way to do this? The only way I know how to do this will be to rename each variable and do an array for each day and associate it to the calculated days for that week.

Thanks, I'm just looking for new ideas. I can do it this way if it is the best way.
Frequent Contributor
Posts: 78

Re: Looking for a way to assign "days" between two dates with no date value

Nevermind, I have it working now :-)

Thanks!
Ask a Question
Discussion stats
  • 1 reply
  • 114 views
  • 0 likes
  • 1 in conversation