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!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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