SPSS Tutorials


SPSS Clone Variables Tool

SPSS Clone Variables Tool

In SPSS, I don't like to recode variables into new variables: the new variables don't have any dictionary information such as variable/value labels or formats. Second, a recoded variable is appended to the end of the file but I rather have it in its original position.
Both problems are avoided by recoding into the same variables. However, I do like to compare the old and new values to see if everything went right. An easy way for doing so is first cloning a variable and then recoding the original variable into the same variable. The clone now serves as a backup to which I can compare the recoded result.

This tutorial presents a super easy tool for cloning one or many variables. It copies variables’ values plus all dictionary information (such as variable labels, value labels, user missing values and formats) from the original variables to the copies. Hence, it really “clones” variables except for their names. Give it a try. You'll love it.

How Does It Work?

SPSS Clone Variables - Example 1

Those who want to give it a quick shot can download and open freelancers.sav. For cloning the first variable, id, we simply enter it into the first box.

SPSS Clone Variables Tool Example 1

We'll leave the second box unaltered. Now, clicking Paste results in SPSSTUTORIALS CLONE VARIABLES VARIABLES ='id' PREFIX ='copy_'. Upon running this line of syntax, a new variable called copy_id appears in our data. Except for its name, it's an exact clone of its original counterpart, including its variable label.

SPSS Clone Variables Tool Result

SPSS Clone Variables - Example 2

Now let's clone the next two variables, gender and birthday. We can now copy-paste the line of syntax we just pasted and simply change it to SPSSTUTORIALS CLONE VARIABLES VARIABLES ='gender birthday' PREFIX ='copy_'. After running it, note that copy_birthday is a date variable just like its original counterpart.

SPSS Clone Variables - Example 3

Finally, we can clone an entire section of variables by using SPSS’ TO keyword. For instance, we can clone source_2010 through source_2014 by running SPSSTUTORIALS CLONE VARIABLES VARIABLES = 'source_2010 to source_2014' PREFIX ='copy_'.

It's as easy as that. I hope you'll like this tool as much as I do.

Thanks for reading!

Previous tutorial: SPSS Recode Values with Value Labels

Next tutorial: SPSS String Variables Basics

Let me know what you think!

*Required field. Your comment will show up after approval from a moderator.

This tutorial has 22 comments