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?
Content-Type: text/plain; format=flowed
>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"?
How big a data set are you dealing with? How many conversions will
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
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
But a more complex problem might require a much more complex approach.
David L. Cassell
3115 NW Norwood Pl.
Corvallis OR 97330
Get a FREE small business Web site and more from Microsoft® Office Live!