LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
=========================================================================
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
Comments: To: besheer mohamed <besheermohamed@yahoo.com>
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.


Back to: Top of message | Previous page | Main SPSSX-L page