Date: Fri, 14 Mar 2003 21:24:54 -0800
Reply-To: "Huang, Ya" <yhuang@AMYLIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Huang, Ya" <yhuang@AMYLIN.COM>
Subject: Re: ERROR: INPUT function requires a character argument. ??
Content-Type: text/plain; charset="iso-8859-1"
Thank Jack, I think your explanation make sense. In that sense, I agree with you that
SAS should treats the implicite conversion in data step as an error.
Kind regards,
Ya Huang
-----Original Message-----
From: Jack Hamilton [mailto:JackHamilton@firsthealth.com]
Sent: Friday, March 14, 2003 5:23 PM
To: Huang, Ya; SAS-L@LISTSERV.UGA.EDU
Subject: Re: [SAS-L] ERROR: INPUT function requires a character
argument. ??
You get a similar message in the data step; it tells you that numeric
values have been converted to character (the implicit conversion messag
which is frequently mentioned here).
You created an informat with the INVALUE DOSLEV statement, and an input
format *always* expects to read a character value. In the data step,
your numeric 5 is being converted to a character "5", and then that
character "5" is being run through the informat.
SQL won't do that implicit conversion for you; instead, it gives an
error message.
I'd like SAS to add an option which treats implicit conversions in the
data step as errors.
--
JackHamilton@FirstHealth.com
Manager, Technical Development
Metrics Department, First Health
West Sacramento, California USA
>>> "Huang, Ya" <yhuang@AMYLIN.COM> 03/14/2003 4:50 PM >>>
Hi,
It seems to me that input function behaves differently
between data step and sql:
proc format;
invalue doslev
1,2,3 = 0.02
4,5,6 = 0.04
;
run;
data _null_;
a=5;
b=input(a,doslev.);
put a= b=;
run;
data xx;
a=5;
run;
proc sql;
select a, input(a, doslev.) as b
from xx;
For the data step, everything seems OK,
but for the sql, I got the following error message:
ERROR: INPUT function requires a character argument
Isn't it strange?
Ya