data demo;
input pid bdate: date9. svdate: date9.;
format bdate svdate date9.;
days=intck('day',bdate,svdate);
months=intck('month',bdate,svdate);
years=intck('year',bdate,svdate);
usingyrdiff= int(yrdif(bdate, svdate, 'actual'));
cards;
101 19mar1978 14feb2005
102 20may1975 19mar2006
;
run;
proc print data=demo;
run;In its default setting, INTCK counts the number of interval boundaries between the values. Somebody born on December 31 will be one year old on January 1. To avoid this, you must use the "c" (continuous) modifier.
Hi:
Take a look at this blog article. I think it explains your experience with INTCK https://blogs.sas.com/content/iml/2017/05/15/intck-intnx-intervals-sas.html . Basically, INTCK returns the number of "boundary dates" that have passed. So you need to control for that. There are also some good references at the end of the article.
Cynthia
data demo;
input pid bdate: date9. svdate: date9.;
format bdate svdate date9.;
days=intck('day',bdate,svdate,'c');
months=intck('month',bdate,svdate,'c');
years=intck('year',bdate,svdate,'c');
usingyrdiff= int(yrdif(bdate, svdate, 'actual'));
cards;
101 19mar1978 14feb2005
102 20may1975 19mar2006
;
run;
In its default setting, INTCK counts the number of interval boundaries between the values. Somebody born on December 31 will be one year old on January 1. To avoid this, you must use the "c" (continuous) modifier.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
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.