BookmarkSubscribeRSS Feed
griffinh
Calcite | Level 5

Wow--thank you Reeza for such a comprehensive answer. I will work through this and update you on the result. The version of SAS Enterprise Guide that I am using is more of a GUI/low code environment so I have not written any custom programs. I've already learned a lot--syntax especially--from the snippet of code to recreate the two rows of data. Thank you again, I am diving into this today.

Reeza
Super User

You likely also need to account for Spring Break, so you can add your custom holidays within my logic in the first step - basically add in the extra University closures you need to add. 

s_lassen
Meteorite | Level 14

Not accounting for holidays, you can do it like this:

data want;                                         
  set have;                                        
  array week(*) Sunday--Saturday;                  
  days=0;                                          
  do _N_=1 to dim(week);                           
    if week(_N_) then                              
      days+intck(cats('week.',_N_),bannerStartDate-1,bannerEndDate);                
    end;                                           
run;

The INTCK function counts the number of Sundays passed with first parameter=WEEK.1, Mondays with WEEK.2, etc. We have to subtract one from the first date in case the period starts on a relevant day.

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
  • 17 replies
  • 3428 views
  • 0 likes
  • 5 in conversation