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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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