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 2011)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 8 Jul 2011 10:17:33 -0400
Reply-To:     Gene Maguin <emaguin@buffalo.edu>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Gene Maguin <emaguin@buffalo.edu>
Subject:      Re: deleting blanks in string variables
In-Reply-To:  <1310123648058-4564392.post@n5.nabble.com>
Content-Type: text/plain; charset="us-ascii"

I'm curious about this. When you do what Bruce suggested,

COMPUTE new_var=REPLACE(old_var," ","").

what is the character that replaces the " "? Is it another space (decimal 32/hex 20)? Something else?

Gene Maguin

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Bruce Weaver Sent: Friday, July 08, 2011 7:14 AM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: deleting blanks in string variables

You didn't specify what to replace " " with. Try this:

COMPUTE new_var=REPLACE(old_var," ","").

drfg2008 wrote: > > I would like to delete blanks in a string variable. The data comes from a > DB that put blanks before, in between and at the end of the actual string > like: > > " one" > " two" > " three" > "four " > "five " > " six " > " seven " > > so I tried: > > COMPUTE new_var=REPLACE(old_var," "). > EXECUTE. > > this seems to be a bit naive. > > (I'm not even quite sure if there are always 3 blanks in the beginning, or > in the end, or in between) > > - probably a solution with a loop? - Can't find a solution. > > Thanks. >

----- -- Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.

-- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/deleting-blanks-in-string-vari ables-tp4563967p4564392.html Sent from the SPSSX Discussion mailing list archive at Nabble.com.

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


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