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

Hello,

 

This code has worked for me in the past, but not today. Can you please help suggesting what I'm doing wrong? The output dataset is blank because intck function isn't working properly.

 

My code:

data wow;
set check;
if intck('day',letter_date,today())>50 then output; //here letter_date is a column in check- it's a yyyymmdd date with a format of num8.
run; 

 

Logs:

NOTE: Invalid argument to function INTCK('day',20150727,21746) at line 730 column 6.

 

 

Appreciate the help!

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Looks like you have to convert letter date to an actual date value first like this

 

data wow;
set check;
if intck('day',input(put(letter_date, 8. -l), yymmdd8.),today())>50 then output;
run; 

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

@AJ_Brien wrote:

Hello,

 

This code has worked for me in the past, but not today. Can you please help suggesting what I'm doing wrong? The output dataset is blank because intck function isn't working properly.

 

My code:

data wow;
set check;
if intck('day',letter_date,today())>50 then output; //here letter_date is a column in check- it's a yyyymmdd date with a format of num8.
run; 

 

Logs:

NOTE: Invalid argument to function INTCK('day',20150727,21746) at line 730 column 6.

 

 

Appreciate the help!


It would help if you show us the actual LOG file rather than the code (all of it, not just the error message). And then there will be no inconsistencies between the code in the log and the code you present, as I suspect here.

 

I am guessing, but it seems as if your variable letter_date is not an actual SAS date value, it is some integer that looks like a date to humans but does not look like a date to SAS. So, INTCK works only with SAS date values, such as '01JUN2019'd, or integers representing days from Jan 1, 1960.

--
Paige Miller
ballardw
Super User

A numeric value of 6,588,970 is 31 Dec 19,999. So 20,150,727 would be about year 60,000.

SAS date values only go to 31 Dec 20000 generally.

 

If this code worked previously then the values were different in range. 27Jul2015 would have a numeric non-date formatted value of 20296.

 

 

https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/... has a PDF with much information about dates.

                              

AJ_Brien
Quartz | Level 8
That is correct, I got confused regarding their types and conversions. Thank you!
PeterClemmensen
Tourmaline | Level 20

Looks like you have to convert letter date to an actual date value first like this

 

data wow;
set check;
if intck('day',input(put(letter_date, 8. -l), yymmdd8.),today())>50 then output;
run; 
AJ_Brien
Quartz | Level 8
Yep this worked, I was confused regarding the type conversion. Thank you!

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
  • 5 replies
  • 4611 views
  • 0 likes
  • 4 in conversation