=========================================================================
Date: Tue, 25 Jul 2006 11:00:31 -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: CONCAT
Content-Type: text/plain; charset="US-ASCII"
Good point. A frequent source of confusion with concatenating the values of string variables is that all string variable values are right-padded to the defined width of the string; so an A8 variable with a value of "A" is really "A ". The RTRIM function returns just the "A" without the trailing blanks. This is a factor for string manipulations such as concatenation, but not for conditional expressions. For example IF stringvar="A" will return true for the above example value, regardless of the defined string width.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Spousta Jan
Sent: Tuesday, July 25, 2006 10:30 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Re: CONCAT
Hi Jonathan,
Is the variable Descr long enough? Did you tried to use rtrim?
COMPUTE Descr = CONCAT ("SW ",rtrim(crsno),"-",rtrim(sec)) .
Greetings
Jan
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Jonathan Havey
Sent: Tuesday, July 25, 2006 5:27 PM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: CONCAT
I'm having trouble getting CONCAT to work with more than two items.
COMPUTE Descr = CONCAT ("SW ",crsno,"-",sec) . This successfully concatenates "SW " and the variable crsno, but stops there. The same problem occurs with using just variables.
Jonathan Havey
|