I have two dummy variables, X1 and X2. Each one is coded into 0 or 1. Here is the breakdown:

    alcohol use 
            X7 X8 
   none     0   0 
   moderate 1   0 
   severe   0   1

I don't understand how to tell SPSS that when X7 is 0, AND X8 is 1, that means 'Severe'. The problem arises when I try to do descriptive statistics. It gives me a mean of the 1's and 0's, which is a useless value of 0.5. How are descriptive statistics shown with dummy variables, and especially when the dummy variable is coded across two separate variables?

  • 1
    $\begingroup$ Welcome to the site! A possible solution is to generate a third variable (say z) based on a logical expression like if(x7==0 & x8==1) then z=1, where severe denoted as 1. I am not sure about how to do this in SPSS, but it is easy to do so in Excel and other statistical software. If you set a variable as ordinal or nominal, SPSS would not provide the mean but the frequency. $\endgroup$
    – Randel
    Sep 22, 2013 at 17:17
  • $\begingroup$ Ok cool, thanks Randel. I got it worked out in Excel with nested IF AND statements, and pasted it back into SPSS. Setting them as nominal got me the frequencies. So I'm all set! Thanks! Hopefully someone will chime in with how to accomplish this without the Excel intermediate so we'll know for future reference. $\endgroup$ Sep 22, 2013 at 18:00
  • $\begingroup$ Both variables have a mean of 0.5 ?? So there are no observations with "none" alcohol use? If that's the case, you only need 1 dummy-coded variable, not 2... $\endgroup$ Sep 22, 2013 at 23:48

3 Answers 3


Use this code. (the spacing between lines within a single command need to be removed) I even included value labels :)

IF  (X7=0 & X8 = 0) AlcoholUse=1.
IF  (X7=1 & X8 = 0) AlcoholUse=2.
IF  (X7=0 & X8 = 1) AlcoholUse=3.

1 "none"
2 "moderate"
3 "severe".
  • $\begingroup$ I agree with this approach, though the code can be simplified, but the steps are clear. Also, the 0.5 describe in the question led me think that the average was taken across columns while if you take the average down the who colum (aka mean of X8), the mean should be the fraction of (Number of severe use / total sample). $\endgroup$ Sep 24, 2013 at 4:14

@Hotaka: you don't need so many lines for combining the variables and you certainly don't want execute after each line.

data list free/v1 v2.
begin data
0 0
1 0
0 1
1 1
end data.

compute combined = 2 * v1 + v2 + 1.

For managing labels and other variable properties, have a look at this excellent dictionary tutorial.


From your example, it appears that you only need to consider x8, which already indicates severe or not. But the recoding above will work if you want to combine all the values, but get rid of all those execute statements. They just force unnecessary data passes.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.