SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
StephG
Calcite | Level 5
Can you tell me why the Intck function and the Yrdif function will produce two different values when the input dates are the same? I am trying to calculate time at age of entry for patients, and if I use the Intck funciton I am getting some differences than when I use the Yrdif function. Thanks!
2 REPLIES 2
Peter_C
Rhodochrosite | Level 12
age is an interestingly challenging assumption
(who knows how many ways there are to calculate age? 😉
-- what would you like ?
- remember years have differing numbers of days
- decide when those born on a 29th Feb should celebrate their 18th and 21st birthdays

age nearest?
age next birthday?
number of days old is probably the only reliable calculation

so again, how would you like to calculate age - what are your rules?

peterC

P.S.
yrdif() is deprecated for age calculations, see SAS USAGE NOTE:
36977 - Using the YRDIF function to calculate age can give incorrect results
at http://support.sas.com/kb/36/977.html
Nietzsche
Lapis Lazuli | Level 10

I found your thread from google and I believe it is the only INTCK vs. YRDIF thread and I am having the same issue while reading the base exam prep guide.

 

INTCK counts +1 every time it encounters 1 Jan. 

YRDIF counts +1 for every 365 (or 360 or 366 days depending on the optional third argument you use, I don't know how the 30/360 work tho)

 

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 2 replies
  • 2614 views
  • 0 likes
  • 3 in conversation