concat: strange behaviour

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

concat: strange behaviour

Frans Marcelissen-3
Hi,
Could anyone explane this to me? I want tot add a substring tot a string. I use spss 18.0
 
string aa(a50).
compute aa=''.
compute aa=concat(aa,"second struing").
exec.
list aa.
 
This leads to a series of empty string.
This however works correctly:
compute aa=concat("second string",aa).
exec.
list aa.
 
 
Why?
Thanks
 
Frans
Reply | Threaded
Open this post in threaded view
|

Re: concat: strange behaviour

taras koniukhov
please, read the classics:
http://spsstools.net/LearningSyntax.htm#StringManipulationTutorial

*------.
compute aa=concat(ltrim(aa),"second struing").
list aa.


2010/10/28 Frans Marcelissen <[hidden email]>
Hi,
Could anyone explane this to me? I want tot add a substring tot a string. I use spss 18.0
 
string aa(a50).
compute aa=''.
compute aa=concat(aa,"second struing").
exec.
list aa.
 
This leads to a series of empty string.
This however works correctly:
compute aa=concat("second string",aa).
exec.
list aa.
 
 
Why?
Thanks
 
Frans

Reply | Threaded
Open this post in threaded view
|

Re: concat: strange behaviour

Frans Marcelissen-3
Thanks. I see the reason, and the solution. I still thing this is very unexpected behaviour.
Frans
 

Date: Thu, 28 Oct 2010 13:51:24 +0300
Subject: Re: concat: strange behaviour
From: [hidden email]
To: [hidden email]
CC: [hidden email]

please, read the classics:
http://spsstools.net/LearningSyntax.htm#StringManipulationTutorial

*------.
compute aa=concat(ltrim(aa),"second struing").
list aa.


2010/10/28 Frans Marcelissen <[hidden email]>
Hi,
Could anyone explane this to me? I want tot add a substring tot a string. I use spss 18.0
 
string aa(a50).
compute aa=''.
compute aa=concat(aa,"second struing").
exec.
list aa.
 
This leads to a series of empty string.
This however works correctly:
compute aa=concat("second string",aa).
exec.
list aa.
 
 
Why?
Thanks
 
Frans

Reply | Threaded
Open this post in threaded view
|

Re: concat: strange behaviour

Jon K Peck
If you use Unicode mode (Edit>Options or SET UNICODE ON.) strings are right-trimmed automatically.  And I suggest using the char. functions in place of the older ones wherever they exist.

Regards,

Jon Peck
Senior Software Engineer, IBM
[hidden email]
312-651-3435




From:        Frans Marcelissen <[hidden email]>
To:        [hidden email]
Date:        10/28/2010 04:29 AM
Subject:        Re: [SPSSX-L] concat: strange behaviour
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Thanks. I see the reason, and the solution. I still thing this is very unexpected behaviour.
Frans


Date: Thu, 28 Oct 2010 13:51:24 +0300
Subject: Re: concat: strange behaviour
From: [hidden email]
To: [hidden email]
CC: [hidden email]

please, read the classics:

http://spsstools.net/LearningSyntax.htm#StringManipulationTutorial

*------.
compute aa=concat(ltrim(aa),"second struing").
list aa.


2010/10/28 Frans Marcelissen <fransiepansiekevertje@...>
Hi,
Could anyone explane this to me? I want tot add a substring tot a string. I use spss 18.0

string aa(a50).
compute aa=''.
compute aa=concat(aa,"second struing").
exec.
list aa.

This leads to a series of empty string.
This however works correctly:
compute aa=concat("second string",aa).
exec.
list aa.


Why?
Thanks

Frans


Reply | Threaded
Open this post in threaded view
|

Re: concat: strange behaviour

David Marso
Administrator
In reply to this post by Frans Marcelissen-3
">please, read the classics:"
It's mostly borrowed, stolen, misattributed or unattributed!!! WTF???
ROTFLMFAO!  Classics???  What planet are you from?
-------------------------------------

On Thu, 28 Oct 2010 13:51:24 +0300, Taras Koniukhov <[hidden email]>
wrote:

>please, read the classics:
>http://spsstools.net/LearningSyntax.htm#StringManipulationTutorial
>
>*------.
>compute aa=concat(ltrim(aa),"second struing").
>list aa.
>
>
>2010/10/28 Frans Marcelissen <[hidden email]>
>
>>  Hi,
>> Could anyone explane this to me? I want tot add a substring tot a string. I
>> use spss 18.0
>>
>> string aa(a50).
>> compute aa=''.
>> compute aa=concat(aa,"second struing").
>> exec.
>> list aa.
>>
>> This leads to a series of empty string.
>> This however works correctly:
>> compute aa=concat("second string",aa).
>> exec.
>> list aa.
>>
>>
>> Why?
>> Thanks
>>
>> Frans
>>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"