Hello,
I can't resolve this problem.
I try to have for each given date, Monday as the start of the week and Friday as the day of the weekend.
The error is made on the first day of the month.
The following example illustrates the error.
Thank you for your help.
data _null_;
date = '03feb2020'd;
firstday = intnx('week.2',date,-1);
lastday = intnx('week.6',date ,-1);
put (date firstday lastday) (= date9.) ;
run;
Log
73 data _null_;
74 date = '03feb2020'd;
75 firstday = intnx('week.2',date,-1);
76 lastday = intnx('week.6',date ,-1);
77 put (date firstday lastday) (= date9.) ;
78
79 run;
date=03FEB2020 firstday=27JAN2020 lastday=24JAN2020
You haven't described the desired output.
As Paige said, post the output you want .
data _null_;
date = '03feb2020'd;
firstday = intnx('week.2',date,-1);
lastday = intnx('week.6',date ,0);
put (date firstday lastday) (= date9.) ;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.