Hello,
I am needing to calculate three business days from OE_DATE & DLVR_STRT_DATE and using the below i am getting three business days between order date & delivery date. however if an order is placed on tuesday then i am getting three business days as wed, thu, fri, sat & sun. I need the sat & sun excluded from the calc as it is > 3 business days. The issue is with orders having order date on tuesdays where the made orders have delivery date on wed, thu, fri, sat & sun where delivery date on sat, sun should be miss as it is > 3 business days. Please advise.
IF intck('WEEKDAY',OE_DATE,DLVR_STRT_DATE) LE 3 then c = 'made'
else c = 'miss';
Did you try the code included?
expected_delivery=intnx('weekday', OE_DATE, 3);
if DLVR_STRT_DATE>expected_delivery then c='made';
else c='miss';
As you are only looking at a few possibilities, maybe best to just do it with manual if statements, e.g.
If weekday(dlvr_strt_date)=1 then checkdt=dlvr_strt_date + 4; /* Sunday so Mon/Tues/Wed */
If weekday(dlvr_strt_date)=2 then checkdt=dlvr_strt_date + 3; /* Monday so Tues/Wed/Thurs */
...
If weekday(dvlr_strt_date)=6 then checkdt=dlvr_strt_date + 5; /* Friday so wed */
...
If dlvr_strt_date <= oe_date <= checkdt then "made";
else "miss";
Note-can't check this at the moment.
I am needing to calculate three business days from OE_DATE & DLVR_STRT_DATE
Do you need to calculate the business day that is 3 days away from each of the date above?
Or if the duration between the two dates is greater than 3 days?
Try using intnx to calculate the 3 day delivery date and check if delivery date is after that date.
expected_delivery=intnx('weekday', OE_DATE, 3);
if DLVR_STRT_DATE>expected_delivery then c='made';
else c='miss';
made = OE_DATE + 3 business days should be less than equal to DLVR_STRT_DATE minus weekends. Please advise.
for example : OE_DATE = Tuesday + 3 business days ( wed, thu, fri ) less than equal to DLVR_STRT_DATE then c='made';
else c='miss';
the below logic works for all days except tuesday where made orders are from wed, thu, fri, sat & sun.
IF intck('WEEKDAY',OE_DATE,DLVR_STRT_DATE) LE 3 then c = 'made'
else c = 'miss';
Did you try the code included?
expected_delivery=intnx('weekday', OE_DATE, 3);
if DLVR_STRT_DATE>expected_delivery then c='made';
else c='miss';
It worked Thank you very much.
The duration between two date columns should be LE 3 business days.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.