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-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 1258 views
  • 0 likes
  • 2 in conversation