NOTE: Invalid argument to function INPUT at line 3403 column 17.

Reply
Contributor
Posts: 68

NOTE: Invalid argument to function INPUT at line 3403 column 17.

Starting a new thread for advice on how to triage (inherited) code with macros, many renames, do loops and character to numeric conversions.

Contributor
Posts: 68

Re: NOTE: Invalid argument to function INPUT at line 3403 column 17.

NOTE: Invalid argument to function INPUT at line 3403 column 17.

Super User
Posts: 11,343

Re: NOTE: Invalid argument to function INPUT at line 3403 column 17.

From your previous thread you had mentioned getting the "invalid argument" note.

And additional bit to look at, you should have in the log somewhere which data set caused the problem.

If you can't identify the specific line due to macro calls and such you may still be able to reduce it to which data step as there would be an output data set name in the summary after the error. Determine which data step should make that call, find that code and extract. Make a subset of the input dataset with the _n_ information:

data testdata;

     set fulldata;

    if _n_ in (123, 3221) ; /* list of _n_ that appear in the log with the note*/

run;

use this step and the extracted code.

For testing purposes you may want to create an original source data set with only a few records so there's less for the program to do.

If you posted the log with the problem we may be more helpful.

You may want to use OPTIONS MPRINT; for one complete run of the program and save the entire log for reference.

Contributor
Posts: 68

Re: NOTE: Invalid argument to function INPUT at line 3403 column 17.

I am running now with MPRINT and removed no to nosource and am running the whole program to save the log. I cannot post the log but for reasons you would not fathom. I can send it but not post it. I will keep trying before considering that option. I have extracted just one quarter and set it that way on another code (previously). I will do that again, here using _n_. Thank you.

Super User
Super User
Posts: 7,076

Re: NOTE: Invalid argument to function INPUT at line 3403 column 17.

Copy the text you want from the log. (Highlight it and press CTRL-C)  Paste it into a WORD document (CTRL-V).

Copy it again in the WORD document. Now you can paste it into the text box on the SAS communities discussion forum.

Why this works I have no idea.  You can also change the font for the text in WORD to a non-proportional one like COURIER or COURIER NEW and it will be more readable in the forum.

Contributor
Posts: 68

Re: NOTE: Invalid argument to function INPUT at line 3403 column 17.

NOTE: There were 1m observations read from the data set data.one.

NOTE: The data set WORK.two has 1m observations and 700 variables.

NOTE: DATA statement used (Total process time):

      real time           55.22 seconds

      cpu time            9.15 seconds

...

NOTE: Numeric values have been converted to character values at the places given by: (Line)Smiley SadColumn).

      19:221   21:9     21:52    27:166

NOTE: Character values have been converted to numeric values at the places given by: (Line)Smiley SadColumn).

      42:7

NOTE: Invalid argument to function INPUT at line 21 column 66.

YGENDER1=2

...

rdate=19540 _ERROR_=1 _N_=79904

NOTE: Invalid argument to function INPUT at line 21 column 66.

I tried:

Data fixerr;

     set data.one and work.two;

     where _errror_ =1;

run;

to identify the obs with errors and nothing meaningful. I am supposed to be able to do this first and then run proc freq to id the cases with errors. I believe it the age var that follows the rdate (messy admin records). Please tell me what is wrong with "fixerr"

Please help. Thank you.

PROC Star
Posts: 7,492

Re: NOTE: Invalid argument to function INPUT at line 3403 column 17.

Can you post line 21 (of your code) so we can see what it looks like?

Contributor
Posts: 68

Re: NOTE: Invalid argument to function INPUT at line 3403 column 17.

It runs with macros, I used MPRINT and source in options but still did not generate a line 21; starts at 1151. Displaying this inherited code on a public forum is not a possibility. Please let me know other questions for help assist. Thanks.

PROC Star
Posts: 7,492

Re: NOTE: Invalid argument to function INPUT at line 3403 column 17.

Have you tried also executing the options mlogic and symbolgen?

Super User
Posts: 19,865

Re: NOTE: Invalid argument to function INPUT at line 3403 column 17.

Search the code for input statements is another method. Depending on the code this could a long search but could make it binary.

Ie run half macro at a time to isolate the problem. If the first half doesn't generate issues run 3/4, if still no issues then next few steps and so forth.

Super User
Posts: 7,854

Re: NOTE: Invalid argument to function INPUT at line 3403 column 17.

INSPECT. YOUR. DATA.

_N_ = 79904 gives you a really good clue where to start looking.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 68

Re: NOTE: Invalid argument to function INPUT at line 3403 column 17.

Thanks for all the help on this forum. I am new to data w admin records and running inherited code with advanced functions with limited familiarity. With all your help, I was able to run the code without macros and with only one quarter, rather than four and in sections. The data has "##" for some of the records where numeric was required (which altered the input function). I was only told by the original programmer that they were not critical and to use syntax using _error_ =1. I tried that and could not get that method to work. I want to try it again knowing what I know now, and if anyone has an idea using that syntax. If not, I can take it from here. Although she said the errors were non-critical, i needed to understand the extent of the problem, so I persisted. painfully. Again, thank you.

Contributor
Posts: 68

Re: NOTE: Invalid argument to function INPUT at line 3403 column 17.

And its all about knowing your data!

PROC Star
Posts: 7,492

Re: NOTE: Invalid argument to function INPUT at line 3403 column 17.

Two ways to suppress and ignore errors, on input, are shown at: SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition

Super User
Posts: 7,854

Re: NOTE: Invalid argument to function INPUT at line 3403 column 17.

If you know in advance that ## is meant to represent a missing or special value, handle that specifically. Suppressing error messages as such opens the door for real invalid data to sneak in.

Rather do

if invalue = '##' then outvalue = .; else outvalue = inpu(invalue,some_format.);

than tinkering with options to reduce the error checking of the SAS system.

I WANT my programs to fail when something undefined comes along.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 14 replies
  • 4952 views
  • 1 like
  • 6 in conversation