LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 21 Jun 2007 10:08:49 -0700
Reply-To:     jamesgreen55@YAHOO.CA
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         jamesgreen55@YAHOO.CA
Organization: http://groups.google.com
Subject:      Re: help with warning
Comments: To: sas-l@uga.edu
In-Reply-To:  <456B52C41B724C41B96561D7AD283E7D6C756C@mail.chpdm.umbc.edu>
Content-Type: text/plain; charset="us-ascii"

On Jun 21, 11:38 am, JCl...@CHPDM.UMBC.EDU (Jack Clark) wrote: > Ian, > > Perhaps I need a little more explanation on this. I understand what you > are saying about the programmer having to specify length for BENPKG if > it was not on FINAL. I don't understand why > > But I don't understand why you stated that the program and messages > imply that BENPKG is not a variable in the input FINAL dataset? Why > would a program check if BENPKG is missing right after the SET statement > if BENPKG is not on the input dataset? As for the log messages... > > When I run the code... > > * benpkg in FINAL ; > data final; > benpkg = 'xyz'; > benpkg2 = '123'; > output; > benpkg = ' '; > benpkg2 = '789'; > output; > run; > > data final (drop=benpkg2) ; > set final; > if benpkg=. then benpkg =benpkg2; > run; > > I see notes in the log similar to what the original poster provided... > > NOTE: Character values have been converted to numeric values at the > places given by: > (Line):(Column). > 158:4 > NOTE: Invalid numeric data, benpkg='xyz' , at line 158 column 4. > benpkg=123 benpkg2=123 _ERROR_=1 _N_=1 > > If I create FINAL without BENPKG, and run the same code, I do not get > those messages in the log - only one about a conversion performed by > SAS. > > * BENPKG not in FINAL ; > data final; > benpkg2 = '123'; > output; > benpkg2 = '789'; > output; > run; > > data final (drop=benpkg2) ; > set final; > if benpkg=. then benpkg =benpkg2; > run; > > NOTE: Character values have been converted to numeric values at the > places given by: (Line):(Column). 173:26 > > Thank you. > > Jack Clark > Research Analyst > Center for Health Program Development and Management > University of Maryland, Baltimore County > > > > -----Original Message----- > From: SAS(r) Discussion [mailto:S...@LISTSERV.UGA.EDU] On Behalf Of Ian > > Whitlock > Sent: Thursday, June 21, 2007 11:15 AM > To: S...@LISTSERV.UGA.EDU > Subject: Re: help with warning > > Summary: The lengths of new character variables must > be set by the programmer. > #iw-value=1 > > vldesi...@GMAIL.COM, > > The program and messages you describe imply that BENPKG is > a new variable not on FINAL. Consequently all of the > suggestions like > > 1) if benpkg=' ' then benpkg =benpkg2; > > 2) If Missing( benpkg ) Then benpkg = benpkg2 ; > > 3) BenPkg = CoalesceC( BenPkg , BenPkg2 ) ; > > are wrong. > > Mark's explaination that SAS determined that BENPKG is numeric on the > code > > if BenPkg = . > > is correct. > > You probably should rename BENPKG2 to BENPKG. If this is not the case > then > perhaps you should be careful to explain what you want to accomplish in > English. > > In honor of the recent thread, "Re: mistakes in SAS that don't generate > errors", I note that 1) represents a classic way to have a clean log > with > an undesired result. > > Ian Whitlock > ============== > > Date: Thu, 21 Jun 2007 06:53:44 -0700 > Reply-To: vldesi...@GMAIL.COM > Sender: "SAS(r) Discussion" > From: vldesi...@GMAIL.COM > Organization:http://groups.google.com > Subject: help with warning > Comments: To: sas-l > Content-Type: text/plain; charset="iso-8859-1" > > Hello all, > > I am running this data step > > data final (drop=benpkg2) ; > set final; > if benpkg=. then benpkg =benpkg2; > run; > > both benpkg,benpkg2 are character columns. But I get these notes in the > log > > NOTE: Invalid numeric data, benpkg='NYF1' , at line 9 column 200. pcpid= > 001671-B24 membno=32650901 pcpeff=07/01/2007 pcpexp=. benpkg2=NYF1 > mfstnam= > KUNTIE mmidnam= mlstnam=Doe bthdat=01/24/1983 sexcod=F benpkg=NYF1 > beneff= > 07/01/2007 benexp=. _ERROR_=1 _N_=1 > > Eventually I get the error: > > ERROR: Limit set by ERRORS= option reached. Further errors of this type > will not be printed. > > How do I get rid of this implicit conversion. > > Thanks- Hide quoted text - > > - Show quoted text -

undoubtedly Ian is correct, but in our defence, given the OP's statement:

"..both benpkg,benpkg2 are character columns. But I get these notes in the log ..."

It appeared at least that both variables exist otherwise how could he be certain they (initially) were both character values?

Would it be safe to say that We were not wrong IF the two variables are in the source data set (which we assumed based on the OP's description...?). (Noted; that assumptions are bad).

Worried! James


Back to: Top of message | Previous page | Main SAS-L page