Date: Wed, 24 May 2006 22:04:49 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: Best. informat in input function?
On Wed, 24 May 2006 09:56:57 -0500, Yu Zhang <zhangyu05@GMAIL.COM> wrote:
>David,
>
>The informat BESTw.d can perserve the digits after decimal point.
You don't need the "d" to preserve the digits after the decimal point. In
fact, you probably don't want to code it. If the character values all
contain explicit decimal points, the "d" spec does absolutely nothing. If
some character values lack decimal points, the "d" will imply them and
divide the read-in value by 10**d. Eg, if you have the string
1234
and the informat 32.2, the numeric value will be
12.34
By the way, the concept of a "best" informat is meaningless, or circular.
It's just an alias for the w.d informat.
>
>
>On 5/24/06, David Ryerson <ryersond@yahoo.com> wrote:
>>
>> Hello,
>>
>> I am trying to convert a character variable to a numeric variable with
the
>> input function. The twist is that the values of the character variable
>> vary quite a bit in terms of no decimal, one digit after decimal, etc.
I
>> have been using the following to do this:
>>
>> numval=input(charval,best.);
>>
>> Is the best. informat the way to go here? To this point it seems to be
>> working, but I'm wondering if there are any problems lurking around the
>> corner.
>>
>> Thanks,
>> David
>>
|