BookmarkSubscribeRSS Feed
Sathish_jammy
Lapis Lazuli | Level 10

Hi community,

 

I'm looking a decimal value for the month column. For Year value i got the exact one. I have a trouble with the dd_m (month) column. 

While using INTCK func i got a month value but without a decimal.

Please suggest me to solve it.

 

data eee;
input dateonset mmddyy10.;
cards;
02/19/2004
01/20/2003
05/10/2003
05/21/2003
12/24/2002
05/20/2003
;


data dur1;
set eee;
tday = today();
dur_d = tday - dateonset;
dd_m = intck('month',dateonset,tday);
/**dd_m = dur_d / 12;****(Wrong value)***/  
dd_y = dur_d / 365.25;
format dd_y 4.1 dd_m 4.1 tday dateonset mmddyy10.;
run;
proc print;
run;

 

3 REPLIES 3
DJongman
Obsidian | Level 7

As you state that year value is correct:

 

dd_m2 = (dur_d / 365.25)*12;
Ksharp
Super User
dd_m=yrdif(start,end,'act/act')*12;
ballardw
Super User

Since months vary from 28 to 31 days the decimal portion is highly suspect in interpretation.

If you really need finer increments I would suggest days.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1071 views
  • 0 likes
  • 4 in conversation