BookmarkSubscribeRSS Feed
Kraj1989
Calcite | Level 5

data test2;
weekdays=intck('Weekday','01May2019'd,'18May2019'd);
run;

it suppose to give me 13 days but giving 12 days, Any one know why it is giving 12 days

2 REPLIES 2
Astounding
PROC Star

INTCK counts the number of boundaries crossed.  It does not count May 1, in your example.  The first "crossing" is the boundary from May 1 to May 2.

PGStats
Opal | Level 21

Look at this little test:

 

50   data _null_;
51   fromDate = '01May2019'd;
52   do toDate = fromDate to '18May2019'd;
53       weekdays=intck('Weekday', fromDate, toDate);
54       put fromDate downame. +1  fromDate yymmdd10. +1
55           toDate downame. +1    toDate yymmdd10. +1
56           weekDays;
57       end;
58   run;

Wednesday 2019-05-01 Wednesday 2019-05-01 0
Wednesday 2019-05-01  Thursday 2019-05-02 1
Wednesday 2019-05-01    Friday 2019-05-03 2
Wednesday 2019-05-01  Saturday 2019-05-04 2
Wednesday 2019-05-01    Sunday 2019-05-05 2
Wednesday 2019-05-01    Monday 2019-05-06 3
Wednesday 2019-05-01   Tuesday 2019-05-07 4
Wednesday 2019-05-01 Wednesday 2019-05-08 5
Wednesday 2019-05-01  Thursday 2019-05-09 6
Wednesday 2019-05-01    Friday 2019-05-10 7
Wednesday 2019-05-01  Saturday 2019-05-11 7
Wednesday 2019-05-01    Sunday 2019-05-12 7
Wednesday 2019-05-01    Monday 2019-05-13 8
Wednesday 2019-05-01   Tuesday 2019-05-14 9
Wednesday 2019-05-01 Wednesday 2019-05-15 10
Wednesday 2019-05-01  Thursday 2019-05-16 11
Wednesday 2019-05-01    Friday 2019-05-17 12
Wednesday 2019-05-01  Saturday 2019-05-18 12

Note that weekends are lumped with Fridays in the counting of weekdays.

PG

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1006 views
  • 1 like
  • 3 in conversation