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-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!

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