Concatenating String Variables in IBM SPSS Statistics AWS [PDF]

What is Concatenating? ▫ Merging two or more sting variables into a single variable is called concatenating variables.

51 downloads 26 Views 445KB Size

Recommend Stories


IBM SPSS Statistics Server
The beauty of a living thing is not the atoms that go into it, but the way those atoms are put together.

IBM SPSS Statistics
It always seems impossible until it is done. Nelson Mandela

[PDF] IBM SPSS for Introductory Statistics
When you do things from your soul, you feel a river moving in you, a joy. Rumi

[PDF] IBM SPSS for Introductory Statistics
It always seems impossible until it is done. Nelson Mandela

IBM SPSS Statistics Base 25
Forget safety. Live where you fear to live. Destroy your reputation. Be notorious. Rumi

IBM SPSS Statistics Base 23
What you seek is seeking you. Rumi

[PDF] IBM SPSS for Intermediate Statistics
You often feel tired, not because you've done too much, but because you've done too little of what sparks

IBM SPSS Statistics Base 23
Every block of stone has a statue inside it and it is the task of the sculptor to discover it. Mich

IBM SPSS Statistics Base 22
We can't help everyone, but everyone can help someone. Ronald Reagan

IBM SPSS Advanced Statistics 22
When you do things from your soul, you feel a river moving in you, a joy. Rumi

Idea Transcript


Concatenating String Variables in IBM SPSS Statistics

What is Concatenating?

 Merging two or more sting variables into a single variable is called concatenating variables  This function can be very useful if you are working with string data in SPSS  One common use of this function is to bring first name and last name from two variables into one single full name variable

2

How to Concatenate?

 String Variables can be concatenated in IBM SPSS Statistics using the CONCAT function  The following syntax demonstrates using a compute command to bring three single name variables together into a single variable, which combines the three into a full name variable

3

CONCAT Function in Syntax

 The first piece of syntax simply creates a datafile in SPSS to be worked with •

DATA LIST /First_Name 1-4(A) Initial 5-6(A) Last_Name 6-20(A). BEGIN DATA Rob E Barry Ian L O'Connell Ted W Payne Rod G Early Con T Not Cat P Murphy Pat C Clifford Bob A O'Sullivan END DATA. 4

CONCAT Function in Syntax

 The STRING function below creates a string variable with 64 characters allocated to it•

STRING Full_Name(A64)

 The CONCAT Function is then used to combine the three variables ‘First_Name’, ‘Initial’ and ‘Last_Name’  Notice how CONCAT needs to use the functions ‘rtrim’ and ‘trim’, which remove any blank spaces on the left side (ltrim) and the right side (rtrim) •

5

COMPUTE Full_Name =CONCAT(rtrim(ltrim(First_Name))," ",rtrim(ltrim(Initial))," ",rtrim(ltrim(Last_Name))). EXEUTE.

For more Tech Tips visit www.presidion.com/ibm-spss-technical-tips

www.presidion.com

Talk to us 

[email protected]

 +44 (0)208 757 8820 (UK)  +353 (0)1 415 0234 (IRL)

Smile Life

When life gives you a hundred reasons to cry, show life that you have a thousand reasons to smile

Get in touch

© Copyright 2015 - 2024 PDFFOX.COM - All rights reserved.