Hi,
any idea how I resolve this error message please?
Code below -
%let offset = -1;
%let completion_date=%sysfunc(intnx(month,%sysfunc(today()),&offset.),date9.); %put &completion_date;
data split;
set input.CO_SPLIT_&runmonth. (keep= mo split applseq completion_date);
sl_applseq=applseq+0;
where intck("month",completion_date,"&completion_date."d)=0;
run;
I think you need to convert the character dates to numeric.
The error says it all:
ERROR: Function INTCK requires a numeric expression as argument 2
where intck("month",completion_date,"&completion_date."d
^
The arrow indicates the second argument, that needs to be numeric, assuming it is character currently. May input(completion_date,ddmmyy10.)?
The variable is a Charecter $CHAR16.
I have tried the input but that doesn't seem to work, most likely as I'm not sure how it fit's within my code?
data split;
set muinput.COMPS_SPLIT_5YEARS_&runmonth. (keep= mortgage split applseq completion_date);
sl_applseq=applseq+0;
input (completion_date, ddmmyy10.);
where intck("month",completion_date,"&completion_date."d)=0;
run;
@Brandon16 wrote:
The variable is a Charecter $CHAR16.
I have tried the input but that doesn't seem to work, most likely as I'm not sure how it fit's within my code?
data split;
set muinput.COMPS_SPLIT_5YEARS_&runmonth. (keep= mortgage split applseq completion_date);
sl_applseq=applseq+0;
input (completion_date, ddmmyy10.);
where intck("month",completion_date,"&completion_date."d)=0;
run;
input() is not a statement, it is a function.
Use
newvar = input(oldvar,format.);
to create a numerical variable from a character variable. Note that you cannot convert "in place", a variable keeps its type.
Use a format that fits the layout of your character data. If in doubt, post some example values for your completion_date.
The variable COMPLETION_DATE is a character variable. If it looks to you like it has date values then you need to use the INPUT() function to convert it to actual date values. For examples if the values looke like '01JAN2017' then you could use the DATE9 informat to convert.
where intck("month",input(completion_date,date9),"&completion_date."d)=0;
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: