Date: Mon, 19 Jul 2004 17:18:18 -0400
Reply-To: Sigurd Hermansen <HERMANS1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Sigurd Hermansen <HERMANS1@WESTAT.COM>
Subject: Re: Character/Numeric Variable Error Message
Content-Type: text/plain
Sharon:
SAS SET'ting of two SAS datasets containing the same variable name and the
same type of variable works reliably. A number of side conditions may lead
to the 'both character and numeric' error. For example,
1) conversion and renaming of variables (especially implicit conversions in
assignments);
2) variables read from external sources (Excel, Oracle, etc.);
3) views of datasets containing data type conversions.
I am guessing that you have posted a simplified version of your program.
Usually a good idea, but in this case carried too far. As posted, it does
not provide enough detail. Check the libraries from which you are reading
the datasets and make sure that the actual program does not contain
something like 'fruit=01;' that would trigger an implicit conversion of your
data.
Sig
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Sharon
Sent: Monday, July 19, 2004 4:30 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Character/Numeric Variable Error Message
Hi,
I get the following error message when I try to combine datasets.
24 data blue;
25 set berry raison;
ERROR: Variable fruit has been defined as both character and numeric.
26 by fruit; run;
I doubled checked to ensure that both "fruit" variables in berry and raison
are both character variables. I've even gone as far as to write if-then
statements to make sure they are character (if berry = '01' then berry =
'01'). I don't understand why I keep getting this error message.
Furthermore, I did a proc contents on both data sets and they both say that
"fruit" is a character variable. any suggestions? thank you.