Date: Tue, 29 Mar 2005 08:51:00 -0800
Reply-To: Dale McLerran <stringplayer_2@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dale McLerran <stringplayer_2@YAHOO.COM>
Subject: Re: IsNumeric in SAS?
Content-Type: text/plain; charset=us-ascii
Sorry, this is not an acceptable solution. Only a restricted
set of alpha characters (letters of the alphabet) have case
representations. Symbols do not. If we had var=3!9 and we
tested upcase(var)=lowcase(var), then the expression would
be true and you would conclude that the string 3!9 was numeric.
However, 3!9 is not a number. Therefore, this is not an
acceptable test for whether a string is character or numeric.
--- Praveen <ipkrishna@GMAIL.COM> wrote:
> Hi Chris,
> Many great ways to solve your problem. I think even I can provide
> If upcase(var)=lowcase(var) then var=numeric; else var=non_numeric;
> See if this works. I have not tried it yet.
> Praveen Krishna
> On Mon, 28 Mar 2005 09:38:55 -0500, Christopher Amherst
> <email@example.com> wrote:
> > Likely a basic question with a simple answer...
> > I have a dataline that I read in from a textfile (in a DATA Step).
> > The line is _suppose_ to be in a format consisting of a number
> (two digit
> > year) followed by three codes, followed by the next year.
> > Ex.
> > 89 ABC DEF GHI 90
> > Problem is that user entry error creates lines such as -
> > 89 ABC DEF GHI ~ 90 <OR> 89 ABC ~ ~ ~ 90.
> > Tildes are valid for missing values, but there are only suppose to
> be 3
> > codes, not more.
> > So, to triage this, I'm creating a minor loop to parse any line
> > formatted.
> > However, to do so I'm trying to find a function in SAS that can
> work as
> > 'IsNumeric' (ie. tells me if the value of the variable is numeric),
> so that
> > I can say:
> > IF IsNumeric(array[I]) AND Array[I] NE . THEN DO..
> > Haven't found any aforementioned function in the documentation
> yet.. but
> > that's likely just that I'm not looking in the right
> > direction.
> > (If push comes to shove, I'll just triage this on the Perl side
> (where the
> > input files are put through a preliminary data cleaning) rather
> than the
> > SAS side..)
> > Thoughts? / Suggestions?
> > Christopher Amherst
> P. Krishna,
> New Delhi,
Fred Hutchinson Cancer Research Center
Ph: (206) 667-2926
Fax: (206) 667-5977
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!