DATA Step, Macro, Functions and more

ERROR: Function INTCK requires a numeric expression as argument 2.

Reply
Frequent Contributor
Posts: 140

ERROR: Function INTCK requires a numeric expression as argument 2.

[ Edited ]

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;

Occasional Contributor
Posts: 5

Re: ERROR: Function INTCK requires a numeric expression as argument 2.

I think you need to convert the character dates to numeric.

Super User
Super User
Posts: 7,399

Re: ERROR: Function INTCK requires a numeric expression as argument 2.

The error says it all:

ERROR: Function INTCK requires a numeric expression as argument 2

where intck("month",completion_date,"&completion_date."d)=0;

                             ^ 

The arrow indicates the second argument, that needs to be numeric, assuming it is character currently.  May input(completion_date,ddmmyy10.)?

Frequent Contributor
Posts: 140

Re: ERROR: Function INTCK requires a numeric expression as argument 2.

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;

Super User
Posts: 6,932

Re: ERROR: Function INTCK requires a numeric expression as argument 2.


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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Super User
Posts: 6,499

Re: ERROR: Function INTCK requires a numeric expression as argument 2.

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; 
Ask a Question
Discussion stats
  • 5 replies
  • 228 views
  • 0 likes
  • 5 in conversation