BookmarkSubscribeRSS Feed
thanikondharish
Fluorite | Level 6
Diff=intck('week','31dec2018'd,'01jan2019'd,'c');

Diff1=intck('week','31dec2018'd,'01jan2019'd,'d');

If I use above code I am getting '0' for both variables .
Can you explain?
4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

 

These dates are a Monday and a Tuesday, so are in the same week.

 

Note that weeks start on Sunday -not Monday- in the crazy world of SAS week functions (might be a US thing).

 

Use 'week.2' to start the week en Monday. 

 

Finally, the 'c' parameter shifts the start of the week to the first date.

 

thanikondharish
Fluorite | Level 6
Thanq .I understood
SASKiwi
PROC Star

The INTCK function only counts whole intervals. The "C" - continuous - option counts whole weeks so until you have 7 days between the start and end date the result will be 0. The "D" - discrete option counts interval boundaries. By default the WEEK boundary is Saturday to Sunday. Your dates cover Monday to Tuesday so they don't cover a week boundary, so the result is also 0.

thanikondharish
Fluorite | Level 6
Thanq.I understood

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 4 replies
  • 1058 views
  • 1 like
  • 3 in conversation