BookmarkSubscribeRSS Feed

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;

5 REPLIES 5
abhityagi
Obsidian | Level 7

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

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.)?

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;

Kurt_Bremser
Super User

@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.

Tom
Super User Tom
Super User

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; 

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