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 (September 2005)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 29 Sep 2005 16:58:47 -0500
Reply-To:     Arthur Aguirre <arthur.aguirre@INCEPTA-MI.COM>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Arthur Aguirre <arthur.aguirre@INCEPTA-MI.COM>
Subject:      Re: String Transformation
Comments: To: Richard Ristow <wrristow@mindspring.com>
Content-Type: text/plain; charset="us-ascii"

I see what you're meaning here, and this has given me some good ideas. Thanks.

-----Original Message----- From: Richard Ristow [mailto:wrristow@mindspring.com] Sent: Thursday, September 29, 2005 4:29 PM To: Arthur Aguirre; SPSSX-L@LISTSERV.UGA.EDU Subject: Re: String Transformation

At 12:39 PM 9/29/2005, Arthur Aguirre wrote:

>I have the following compute function: > >comp x=concat("if"," ","y=","""",ltrim(rtrim(y)),"""","","code="," >","."). > >It would be useful to insert tab spaces verses singles spaces (" "). >Anyone know if this is possible?

Do you mean, having the components, like "y=", starting at fixed positions in the string? If so, it can be done, but the neck is what it's a pain in. I've done it this way, though this particular code is untested.

Suppose you want 'y=' to start in position 8; the literal """",ltrim(rtrim(y)),"""","" to start in position 14; the assignment and command terminator "code=","","." to start in position 26;

First, I'm going to recast your expressions so literals in YOUR code are delimited by single quote, and literals in the OUTPUT code delimited by double quotes. Sorry: code that writes code is very hard to read at the best of times. Very much including my own, for that purpose. If I get this right, it may be a little easier to read. (But I don't think it is wholly right.)

Position 01: 'if' Position 08: 'y=' Position 14: CONCAT('"', ltrim(rtrim(y)), '"', '') Position 26: CONCAT('code=', '', '.').

The pain in the neck COMPUTE x = 'if'. COMPUTE SUBSTR(x,08) = 'y='. COMPUTE SUBSTR(x,14) = CONCAT('"', ltrim(rtrim(y)), '"', ''). COMPUTE SUBSTR(x,26) = CONCAT('code=', '', '.').

I'm sure I've got syntax errors in there. Maybe, at least that's a usable idea.

_____________________________________________________________________ VirusChecked for Huntsworth plc _____________________________________________________________________

______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________


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