Very basic question

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

Very basic question

fevziesen
Hi,

I have a very basic question but I could not resolve it

I want to merge x and y variables like indicated in ''new'' column.

x     y      new
15   10     1510
20   ab     20ab



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Very-basic-question-tp5728289.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Very basic question

parisec

This should do it.

string new (A12).
compute new= concat(Rtrim(x), Rtrim(y)).




fevziesen wrote
Hi,

I have a very basic question but I could not resolve it

I want to merge x and y variables like indicated in ''new'' column.

x     y      new
15   10     1510
20   ab     20ab



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Very-basic-question-tp5728289.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Very basic question

David Marso
Administrator
Need to be careful if there are any leading spaces.
Note, IF UNICODE is ON the RTRIM is not necessary but LTRIM is required (if there are leading spaces).
I'd say to be on the safe side use.
CONCAT(LTRIM(RTRIM(x)),LTRIM(RTRIM(y))).
If there are no leading spaces and UNICODE is ON you can simply use CONCAY(x,y).

parisec wrote
This should do it.

string new (A12).
compute new= concat(Rtrim(x), Rtrim(y)).




fevziesen wrote
Hi,

I have a very basic question but I could not resolve it

I want to merge x and y variables like indicated in ''new'' column.

x     y      new
15   10     1510
20   ab     20ab



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Very-basic-question-tp5728289.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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?"
Reply | Threaded
Open this post in threaded view
|

Re: Very basic question

fevziesen
Thanks all,

omg it is so simple. my brain stopped working for a second:)