BookmarkSubscribeRSS Feed
GN0001
Barite | Level 11

Hello team,

I have a program that reads a text file and then do a match with another dataset, it gave errors. I read the log entirely. This is what I got

Invalid argument to function input at line 3186 column 168 

My data has only 3000 rows and 70 colum.

Number of errors in File load = 1

Macro variable SYSCC resolves to 1012.

I don't need the program to be fixed but I do need to know what causes these issues.

Thanks,

Blue Berry

 

 

Blue Blue
4 REPLIES 4
SASKiwi
PROC Star

Typically this would be caused by either an unexpected change to the variable type (character or numeric) used in the argument, or an invalid value in the variable for that argument. An example of an invalid argument  to an INPUT function would be alpha characters rather than a number:

input('12345', best12.); * Valid;
input('ABCD', best12.); * Invalid;

 

GN0001
Barite | Level 11
Hello,
I tested the order of columns and contents from prior month to this month. I can’t see anything is changed and I can’t find the error.

Thanks
Blue berry
Blue Blue
SASKiwi
PROC Star

SAS logs don't lie. If there was no error last month and there is this month then your data has changed to cause it. The challenge is to find what that is.

ballardw
Super User

Show the log of the data step with all the messages. And paste the text in a text box. The message windows will reformat text and the column positions may not align.

 

Line 3186 refers to a program line in the Log, as does column 168. The fact that your data set has 3000 records has NO bearing at all.

The 168 is likely a function call that is attempting to use invalid data. There might even been an explicit display of values that are involved.

 

Here is a contrived example with the log showing a similar message.

150  data junk;
151     set sashelp.class;
152     if name = 'Mary' then newvar = input(sex,4.);
153  run;

NOTE: Invalid argument to function INPUT at line 152 column 35.
Name=Mary Sex=F Age=15 Height=66.5 Weight=112 newvar=. _ERROR_=1 _N_=14

See my error says line 152 and that refers to the line number on the left of the log entry. The column 35 refers to the position of the function Input call on that line (just in case you have multiple calls to the same function on a line which is possible).

The line after that shows the data vector and shows that Sex=F. So trying to read "F" as a number with the 4. informat fails. Note that the _N_ = 14 even tells us which ROW of data has the problem.

 

If your program worked in the past then that means the underlying data changed somehow. The full log, not just one or two lines, often provides lots of examples.

 

I get to deal with this as one of the contractors I work with changes the column order of the files sent about every other month. So I routinely have to change the order of my input statement. The clue is typically an invalid data message (or 20).

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 534 views
  • 3 likes
  • 3 in conversation