From: Paul Dorfman on
Mike,

The most elegant offering by far... ain't them kitty functions neat? And
interestingly,

input (cat(x), 6.)

consistently runs in my test case of

data _null_ ;
input x ;
do i = 1 to 1e7 ;
w = input (cat (x), 6.) ;
end ;
put x=16. @18 w=16. ;
cards ;
12345678912345
10293847
9753
100000
29384756273
;
run ;

in 12.5 seconds compared to 13.9 seconds for input(put(x,32.-L),6.), even
though both are a bit slower than int(x/10**((floor(log10(x))-5)*(x=>1e5)))
at 9 seconds -- the double type conversion apparently takes more time than
even a relatively involved purely numeric expression.

Kind regards
------------
Paul Dorfman
Jax, FL
------------

On Sun, 27 Sep 2009 13:04:58 -0400, Mike Zdeb <msz03(a)ALBANY.EDU> wrote:

>hi ...using Joe's data ...
>
>
>data test;
>input x @@;
>datalines;
>1234567890 123456789 12345678 1234567 123456
>;
>run;
>
>data test;
>set test;
>y=input(cat(x),6.);
>run;
>
>run;
>
>proc print data=test noobs;
>run;
>
>
> x y
>1234567890 123456
> 123456789 123456
> 12345678 123456
> 1234567 123456
> 123456 123456
>
>
>
>
>--
>Mike Zdeb
>U(a)Albany School of Public Health
>One University Place
>Rensselaer, New York 12144-3456
>P/518-402-6479 F/630-604-1475
>
>> I am trying to extract first 6 digits of a (variable-length) numeric ID.
>>
>> data test;
>> x = 614245034;
>> y = put(x,10.);
>> z = substr(y,1,6);
>> w = input(z,6.0);
>> run;
>> proc print; run;
>>
>> Obs x y z w
>>
>> 1 614245034 614245034 61424 61424
>>
>> Arrgh..
>>
>> Can anyone help?
>>
>> Thank you.
>>