=========================================================================
Date: Thu, 6 Jul 2006 14:31:03 -0400
Reply-To: Keith McCormick <keithmc123@gmail.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Keith McCormick <keithmc123@gmail.com>
Subject: Re: typecasting
In-Reply-To: <20060706151234.92357.qmail@web31312.mail.mud.yahoo.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hello Besheer,
COMPUTE numb = number(VAR1,f2.0) . that should take care of the second one.
reading between the lines, you might need to add leading zeros, or
spaces so for the first one the solution would also be a function with
COMPUTE, namely LPAD (or maybe RPAD).
Best,
Keith
keithmccormick.com
On 7/6/06, besheer mohamed <besheermohamed@yahoo.com> wrote:
> Does anyone know how to do either of these in one line?
> 1) widen a string (say from length 4 to 6)
> 2) convert a string to a number.
>
> I know you can do either of these if you're willing to ...
> a) create a temp variable of the desired type/length b) copy the data from the old variable to the temp variable c) delete the old variable d) recreate the old variable as the desired type/length e) copy the data from the temp variable into the recreated variable and f) delete the temp variable...
> but that's insane. Is there an easier way to do either of these actions?
>
> Thanks,
> Besheer
>
>
>
>
> ---------------------------------
> Yahoo! Music Unlimited - Access over 1 million songs.Try it free.
|