BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
twildone
Pyrite | Level 9

Hi....I am trying to calculate the number of days from a clients DOB and a date. I am using INTCK Function and it seems to work until the clients DOB falls on a Leap year. Any suggestions to to fix this....Thanks

 

((intck('Day',input(put(client_dob,8.),yymmdd8.),input(put(date,8.),yymmdd8.),'c'))) as Number_Days

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Have you checked your leap years to make sure the dates are valid?  For example, if your data set contains 19930229, you should be getting an error because there is no February 29 in the year 1993.

View solution in original post

6 REPLIES 6
Reeza
Super User

Please post dates to indicate how the results don't match what you're expecting.

 

Otherwise, simply subtract the two dates to get the number of days.

Astounding
PROC Star

Have you checked your leap years to make sure the dates are valid?  For example, if your data set contains 19930229, you should be getting an error because there is no February 29 in the year 1993.

twildone
Pyrite | Level 9

Hi Astounding....I think you found the problem....the DOB is 19320229 and the birthdate occurring during the fiscal year from 20140401 to 20150331 is probably not a leap year.

Reeza
Super User

No the problem is 1993 is not a leap year, therefore there's no Feb 29th and that's an incorrect DOB, SAS date value.

vandhan
Fluorite | Level 6

You have written C in the quatation marks. what is that meant for ?

please help.

((intck('Day',input(put(client_dob,8.),yymmdd8.),input(put(date,8.),yymmdd8.),'c')))

twildone
Pyrite | Level 9

Hi Vandhan,

 

The 'C' is an optional parameter which refers to the method of 'Continuous'. The alternative method, which is the default method, is 'Discrete'. These optional parameters can be used when calculating the difference between two dates and the 'Continuous' method actually calculates continuous time from the start-of-period date specified in the second parameter of INTCK function.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 6 replies
  • 2851 views
  • 1 like
  • 4 in conversation