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:         Tue, 11 Jul 2006 16:27:03 -0500
Reply-To:     "Oliver, Richard" <roliver@SPSS.COM>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Oliver, Richard" <roliver@SPSS.COM>
Subject:      Re: reverse concat
Comments: To: RAbraham@aaalife.com
Content-Type: text/plain; charset="US-ASCII"

As of SPSS 14, there is a much simpler solution:

compute ssn=replace(ssn, "-", "").

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Renji Abraham Sent: Tuesday, July 11, 2006 3:56 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: reverse concat

Hi Monica,

Try this.

* If I understand your question correctly your current social security number is this form 'xxx-xx-xxxx' and you want it in 'xxxxxxxxx' ( i.e. without the dashes).

STRING PART1 (A3) . COMPUTE PART1 = SUBSTR (SSN,1,3) . EXECUTE . STRING PART2 (A2). COMPUTE PART2 = SUBSTR (SSN,5,2) . EXECUTE . STRING PART3 (A4). COMPUTE PART3 = SUBSTR (SSN,8,4). EXECUTE .

STRING SSN_NEW (A9) . COMPUTE SSN_NEW = CONCAT (PART1,PART2,PART3) . EXECUTE .

DELETE VARIABLES PART1 PART2 PART3 .

This is a long solution. I think others would have an easier solution .

HTH,

Renji

Monica Perry <mperry@pitt.k12.nc.us> Sent by: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU> 07/11/2006 04:35 PM Please respond to Monica Perry <mperry@pitt.k12.nc.us>

To SPSSX-L@LISTSERV.UGA.EDU cc

Subject reverse concat

Hello List,

I need to remove dashes from social security numbers, and I'm having some trouble.

To put them in I use the concat function in the compute dialog box:

SSnumD=concat(substr(SSnum,1,3),'-',substr(SSnum,4,2),'-',substr(SSnum,6,4))

I tried taking the dash out of the '-' parts; leaving it blank the first time, like this --> ' ' and removing the space the second time, like this --> ''

I figured it would read as "From position 1 go 3 spaces, enter nothing, From position 4 go 2 spaces, enter nothing" (instead of reading ' enter dash')

Is there such a thing as unconcatenate?

Any tips would be appreciated. Thanks, Monica

Monica Perry Title 1 Program Specialist Pitt County Schools, Greenville NC


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