Date: Thu, 1 Sep 2011 17:08:58 -0400
Reply-To: Ben <benpub7@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ben <benpub7@YAHOO.COM>
Subject: Re: Leading zeros, plus and minus
default w. for best is 12. it is much better than 4. :)
On Thu, 1 Sep 2011 15:12:30 -0500, Data _null_; <iebupdte@GMAIL.COM> wrote:
>Why is BEST best? It is the same informat. The only difference is
>you have specified the default width which can still be too small.
>Perhaps best is to use w=32. Or measure the string to be sure.
>
>Informats
>w.d Informat
>--------------------------------------------------------------------------
------
>Reads standard numeric data. Category: Numeric
>Alias: BESTw.d, Dw.d, Ew.d, Fw.d
>
>
>
>2420 data _null_;
>2421 foo = '-00000000000001';
>2422 Newfoo=input(Foo,best.);
>2423 put _all_;
>2424 run;
>
>foo=-00000000000001 Newfoo=0 _ERROR_=0 _N_=1
>
>
>On Thu, Sep 1, 2011 at 2:54 PM, Ben <benpub7@yahoo.com> wrote:
>> Hi Ryan,
>>
>> you have to make sure the length of FOO (including +/-) is less than 4.
>>
>> "Newfoo=input(Foo,best.);" would be a better choice.
>>
>>
>>
>> On Thu, 1 Sep 2011 15:52:38 +0000, McNeill, Ryan
<rmcneill@DALLASNEWS.COM>
>> wrote:
>>
>>>Hi,
>>>
>>>I have a character variable called FOO where the values are like +001, -
>> 002, +003, +004.
>>>
>>>I want to convert them to a numeric field. I did it like so:
>>>
>>>NewFOO = input(FOO, 4.);
>>>
>>>By all appearances, everything looks fine. However, is it possible
>> there's something improper happening beneath what appears to be a
correct
>> conversion? Could the plus/minus symbols cause problems?
>>>
>>>Thanks in advance.
>>
|