BookmarkSubscribeRSS Feed
statadm
Fluorite | Level 6
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.
1 REPLY 1
statadm
Fluorite | Level 6
Nevermind, I have it working now 🙂

Thanks!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 912 views
  • 0 likes
  • 1 in conversation