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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1931 views
  • 0 likes
  • 3 in conversation