Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- re: Number of Days between two date with Leap Year

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-23-2016 01:31 PM

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

Accepted Solutions

Solution

08-23-2016
07:59 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-23-2016 01:47 PM

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-23-2016 01:42 PM

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.

Solution

08-23-2016
07:59 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-23-2016 01:47 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-23-2016 02:29 PM - edited 08-23-2016 02:51 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-23-2016 02:35 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-08-2017 02:25 AM

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')))

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-08-2017 07:55 PM

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.