Create a composte variable

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

Posts: 2
Joined: Wed Apr 21, 2010 5:10 pm

Create a composte variable

Postby stheri » Fri Jun 13, 2014 8:25 pm


I am looking for a way to create a composite variable from other variables in SPSS rather then in Excel.

Let's say I have three variables: Visiting the web (yes or no), Subscribed (yes or no) and Satisfied (Very, somewhat, not satisfied). I would like to create a variable that combines several combinations of these variables, allowing me to assign all my respondents to different value of my new variable. For instance :

New variable values :
1 - (visiting the web=yes + Subscribed=no + satisfied=very)
2 - (visiting the web=no + Subscribed=no + satisfied=very)
3 - (visiting the web=no + Subscribed=yes + satisfied=very)
and so on.

In excel, I would use the IF function. But it doesn't seem to work with the compute variable function in SPSS.

Does someone know to make it work?

Thank you in advance,

Posts: 100
Joined: Mon May 19, 2014 6:06 am

Re: Create a composte variable

Postby RubenGeert » Sat Jun 14, 2014 6:38 am

Hi Simon!

Good question! "IF" works fine in SPSS but (counter intuitively) the COMPUTE is implied in the IF command. Just use IF. See

Second, combining the values of several variables is easy but after doing so you'll probably want to apply value labels to the composite variable. A trick here is to CONCAT the value labels of the input variables and convert the (composite) result into a numeric variable. I wrote a tutorial that demonstrates this and walks through the main options (including IF) for combining categorical variables: ... variables/.

Let me know whether that gets you any further, OK?

Kind regards,

Ruben Geert van den Berg

Who is online

Users browsing this forum: No registered users and 3 guests