Date: Thu, 14 Feb 2008 17:22:42 -0500
Reply-To: Mike Rhoads <RHOADSM1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Rhoads <RHOADSM1@WESTAT.COM>
Subject: Re: IsNumber or IsNumeric
In-Reply-To: <1a14fa530802141055t36c6598do2b7789fbf36d5698@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"
Andrea,
You've received a couple of good answers already.
Special variable lists may be useful. _CHARACTER_ can be used as a
variable list to refer to all character variables in a dataset.
Mike Rhoads
Westat
RhoadsM1@Westat.com
-----Original Message-----
From: Andrea Zimmerman [mailto:sassywench74va@gmail.com]
Sent: Thursday, February 14, 2008 1:55 PM
To: Mike Rhoads
Cc: SAS-L@listserv.uga.edu
Subject: Re: [SAS-L] IsNumber or IsNumeric
Is there an effective way to use this function to check a whole field
that is listed as char but really contains just numbers?
I need to go through all my character fields and see if I can reclassify
any of them as numeric without losing information.
Thanks
On 2/5/08, Mike Rhoads <RHOADSM1@westat.com> wrote:
If you are using version 9 of SAS, this is the perfect place for
the
NOTDIGIT function, which "searches a string for the first
occurrence of
any character that is not a digit":
IF NOTDIGIT(TRIM(Item_ID)) = 0 THEN Item_ID = '0' || Item_ID;
Mike Rhoads
Westat
RhoadsM1@Westat.com
-----Original Message-----
From: owner-sas-l@listserv.uga.edu
[mailto:owner-sas-l@listserv.uga.edu]
On Behalf Of fabergoogle
Sent: Tuesday, February 05, 2008 6:36 AM
To: sas-l@uga.edu
Subject: IsNumber or IsNumeric
Hi all,
I have a field (Item_ID) which can contains numbers or text, for
instance:
01011BL
0704CM
19187-P
A3DOM43RP
1012
1013
1014
1015
The last 4 lines are numbers but the first 4 ones are texts.
I have only to manipulate the numeric items in order to add a
zero in
front of them to get:
01012
01013
01014
01015
Can you help me?
Thank you.
--
Andrea Wainwright-Zimmerman
Capital One