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!
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 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.
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.
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;
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!
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.