Date: Wed, 5 Sep 2007 19:31:06 -0700
Reply-To: David L Cassell <davidlcassell@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David L Cassell <davidlcassell@MSN.COM>
Subject: Re: Auto Text to Numeric Conversion?
In-Reply-To: <1188578760.981274.68180@57g2000hsv.googlegroups.com>
Content-Type: text/plain; format=flowed
anderson115@GMAIL.COM wrote:
>
>Is there a simple way to scan all variables for numeric variables
>stored as text and convert them to either an appropriate integer or
>numeric decimal values? This wouldn't include variables that have
>characters and numbers; only numeric values.
>
>Not sure of the correct technical jargon but something where SAS
>automatically chooses the "best format"?
>
>Thank You,
>Aaron
How big a data set are you dealing with? How many conversions will
be needed?
How complex are these 'text values' that need to be converted?
Are you talking about the numbers 'one' to 'ninety-nine' in text form?
Are you talking about a huge range of possibles, including decimal
portions, so there could be something like 'three gazillion four hundred
and eighty one point nine three eight two'?
Are you talking about text constants, like 'pi' and 'e to the fourth power'?
Are there possible misspellings or nonstandard ways of writing the numbers
out?
If the problem is as simple as whole numbers from 1 to N, then you could
use the WORDw. format to build a hash with the text as the key and the
number as the data, for a quick look-up table as you read through the data
file.
But a more complex problem might require a much more complex approach.
HTH,
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330
_________________________________________________________________
Get a FREE small business Web site and more from Microsoft® Office Live!
http://clk.atdmt.com/MRT/go/aub0930003811mrt/direct/01/