BookmarkSubscribeRSS Feed
SAS83
Fluorite | Level 6
I am having two dates in the SAS dataset.
x y
200801 200903
200102 200111


I need to find the number of months these dates apart.

I have used intck but answer looks different.

Can some one help?
3 REPLIES 3
SAS83
Fluorite | Level 6
I got it ..

Below are my original dates :

EFdt PEDt
20100101 201006
20000612 200009


I used this equation to get the difference..


AGE = intck('month',MDY(mod(int(EFDT/100),100),mod(EFDT,100),int(EFDT/10000)),
MDY(mod(PEDT,100),1,int(PEDT/100)));
art297
Opal | Level 21
Your code would be a lot simpler if you input the dates as dates rather than numbers. E.g.:
[pre]
data want;
informat EFdt yymmdd8.;
informat PEDt yymmn6.;
input EFdt PEDt;
age=intck('month',EFdt,PEDt);
cards;
20100101 201006
20000612 200009
;
[/pre]
Art
-------
> I got it ..
>
> Below are my original dates :
>
> EFdt PEDt
> 20100101 201006
> 20000612 200009
>
>
> I used this equation to get the difference..
>
>
> AGE =
> intck('month',MDY(mod(int(EFDT/100),100),mod(EFDT,100)
> ,int(EFDT/10000)),
> MDY(mod(PEDT,100),1,int(PEDT/100)));
SAS83
Fluorite | Level 6
Thanks Art..

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

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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