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 (June 2002)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 13 Jun 2002 11:33:21 -0300
Reply-To:     hmaletta@fibertel.com.ar
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Hector Maletta <hmaletta@fibertel.com.ar>
Subject:      Re: concatenating  variables to create a new variable
Comments: To: Patricia Cleland <Patricia.Cleland@eqao.com>
Content-Type: text/plain; charset=us-ascii

Patricia, it looks you may simply multiply the numeric parts by powers of ten, then add up, then convert to string again if you wish (you may just as well stay numeric). Example: Original ID: '0123', '1234' Converted to numeric and partitioned into X=1, Y=23 for the first case, and X=12 and Y=34 for the second. Syntax: COMPUTE NUMID=X*100+Y. Results: first case is NUMID=123, second case is NUMID=1234, corresponding to the strings '0123' and '1234' in the original string variable. You can use NUMID directly, but just in case you want to go back to string, you may directly convert to string (with RECODE NUMID (convert)INTO Z), and then define your STRINGID inthe following: STRINGID=Z for all cases with numeric values of 1000 or more, and STRINGID=concatenation of '0' and Z for all values below 1000.

Hope this helps.

Hector Maletta Universidad del Salvador Buenos Aires, Argentina Patricia Cleland wrote: > > Dear Listers, > > I have received a data set in which the unique case identifier has been broken down into its constituent parts and the identifier itself dropped from the data set . The problem is that the constituents of the id have been converted from string to numeric format. If the variables were all string, I would simply compute the id by concatenating the values. Unfortunately, in converting the variable to numeric the leading '0' has disappeared, that is I have 1, 2 ,3 rather than 01, 02, and 03. I tried converting the variables back to string and recoding '1' to '01' but I still don't have the leading 0. The variable has legitimate values greater than 9 so I can't simply force a 0 in front of all values. Does anyone have any suggestions? > > Thanks, > > Pat


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