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

Two date as:

CLCL_PAID_DT=22NOV2017:00:00:00.000

CLCL_RECD_DT =12NOV2017:00:00:00.000

 

My code:

INTCK('DAY',t1.CLCL_PAID_DT,t1.CLCL_RECD_DT,'C') AS Age1,

DATDIF(t1.CLCL_PAID_DT,t1.CLCL_RECD_DT,'act/act') AS Age

 

but both without value. Why

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

In SAS what you show is a DATETIME, not a DATE. This is a critical difference as dates use numbers of days as the interval and datetimes are numbers of seconds. Due to a number of issues the range of date values that work with the various functions are limited to dates before the year 20,000. Most datetimes, when treated as dates without conversion, vastly exceed that range.

 

Hence the options of the DTDay, DTMONTH and DTYear functions to address the increments of datetimes instead of dates so the proper conversion is used.

 

OR explicitly use the DATEPART of a datetime value.

View solution in original post

3 REPLIES 3
Reeza
Super User

I think the interval is DTDAY or DAYDT when dealing with date times?

ballardw
Super User

In SAS what you show is a DATETIME, not a DATE. This is a critical difference as dates use numbers of days as the interval and datetimes are numbers of seconds. Due to a number of issues the range of date values that work with the various functions are limited to dates before the year 20,000. Most datetimes, when treated as dates without conversion, vastly exceed that range.

 

Hence the options of the DTDay, DTMONTH and DTYear functions to address the increments of datetimes instead of dates so the proper conversion is used.

 

OR explicitly use the DATEPART of a datetime value.

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

Thank you,

INTCK('DTDAY',CLCL_RECD_DT,CLCL_PAID_DT)

 

works.

 

 

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