I have a questionnaire with a part (a) and part (b). It looks like this:

(a) "Do you ever feel sad":  
    0="never", 1="sometime", 2="often", 3="nearly always"
(b) "How distressed are you by this": 
    0="not distressed", 1="a bit distressed", 2="quite distressed", 
    3="very distressed".

I want to create a new variable:

"Do you feel sad?"
Response: 0="no", but 1="Yes, but no distress", 3="Yes and its distressing".

How can I create this new variable using SPSS?

  • $\begingroup$ I voted to close as off topic. There's no statistical question here. $\endgroup$
    – Macro
    Commented Apr 27, 2012 at 16:41

1 Answer 1


You would have to use logical operators and conditionals.

part a: 0 1 2 3
part b: 0 1 2 3


    0 = (a0)
    1 = ~(a0) & (b0)
    3 = ~(a0) & ~(b0)

I haven't tested this, but the SPSS code for computing the composite scores with the outcome 1 would be something like this:

DO IF ( (A ~= 0) & (B = 0)).
  • $\begingroup$ The question addresses coding and data management. Faulty coding (e.g. 1 2 rather than 0 1) can result in poor statistical models for NHST in regression and is of statistical relevance IMHO. $\endgroup$
    – noumenal
    Commented Apr 27, 2012 at 16:48
  • $\begingroup$ Daniel thanks for the help, although Im not entirely sure how to implement it. Ill have a go later this evening. $\endgroup$
    – Rave
    Commented Apr 27, 2012 at 18:08
  • $\begingroup$ Use the menu command: Transform/Recode into different variables.... You would have to use this command three times. $\endgroup$
    – noumenal
    Commented Apr 27, 2012 at 22:37
  • $\begingroup$ I've had a think about this. On the composite variable for level 1: Frequency of experience (1="sometime", 2="often", 3="nearly always") + Distress (0="no") Surely if No is scored as 0 there is no real need to add it since its inclusion to the frequency items will add no information? So can I recode it as follows? 0 = No 1 = Frequency items (1,2,3) = Yes but not distressing 2= Yes it is distressing (distress items 1,2,3) since anything over 0 = distress on that scale? I hope this make sense :/ $\endgroup$
    – Rave
    Commented Apr 27, 2012 at 22:56
  • 1
    $\begingroup$ Daniel, have a look, ive done it using this syntax. Thx god! Apologies, I have no idea how to use the code syntax for this site. IF (cape1 = 0) cape_1 = 0. IF (cape1 >= 1 and cape1b = 0) cape_1=1. IF (cape1 >= 1 and cape1b >= 1 ) cape_1=2. EXECUTE. $\endgroup$
    – Rave
    Commented Apr 30, 2012 at 16:11

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.