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 (March 2005, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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>
Comments:     DomainKeys? See http://antispam.yahoo.com/domainkeys
From:         Dale McLerran <stringplayer_2@YAHOO.COM>
Subject:      Re: IsNumeric in SAS?
In-Reply-To:  6667
Content-Type: text/plain; charset=us-ascii

Praveen,

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.

Dale

--- Praveen <ipkrishna@GMAIL.COM> wrote: > Hi Chris, > > Many great ways to solve your problem. I think even I can provide > one. > > If upcase(var)=lowcase(var) then var=numeric; else var=non_numeric; > > See if this works. I have not tried it yet. > > Regards, > Praveen Krishna > > > On Mon, 28 Mar 2005 09:38:55 -0500, Christopher Amherst > <camherst@fas.harvard.edu> 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 > incorrectly > > 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, > India. >

--------------------------------------- Dale McLerran Fred Hutchinson Cancer Research Center mailto: dmclerra@NO_SPAMfhcrc.org Ph: (206) 667-2926 Fax: (206) 667-5977 ---------------------------------------

__________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/


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