Compute new variable SPSS

This forum made possible through the generous support of SDN members, donors, and sponsors. Thank you.

reluctantPhd01

Full Member
10+ Year Member
Joined
Feb 13, 2011
Messages
54
Reaction score
0
Hi All,
Sorry, I'm a post-BA and probably not as SPSS smart as everyone else here!
I'm looking at a gigantic sample of about 14,000 psychiatric patients. I just want to get a descriptive sense of the data. Every column is coded as 1/0 for diagnoses. For example, I have 5,666 that have a 1 for MDD, meaning they were given an MDD diagnosis at admission.
How do I compute a new variable to find out how many people had MDD with something else (for example MDD and bipolar I).
 
Analyze -- Descriptive Stats -- Crosstabs.

Put MDD as the column variable, all the other dx as the rows.
 
or, if you want to create a new variable to use in future analyses, you can do data -> recode variable (I think, I don't have SPSS on this computer to check). You can create a new variable name and specify using boolean logic, for example to create a value of 1 for the new variable use:
if MDD=1&(bipolar=1|schizophrenia=1|other disorder=1)
the | (shift + \) means or.
 
or, if you want to create a new variable to use in future analyses, you can do data -> recode variable (I think, I don't have SPSS on this computer to check). You can create a new variable name and specify using boolean logic, for example to create a value of 1 for the new variable use:
if MDD=1&(bipolar=1|schizophrenia=1|other disorder=1)
the | (shift + \) means or.

Close...data>>>transform.

IN SPSS make sure commands are in CAPs...like IF or AND.

First type a new variable and variable label. For this example, lets call it NewVariable.

IF MDD=1 AND bp=1 AND etc etc
NewVariable = 1.

Then create IF statements for all sitations which would result in zero.
IF MDD=1 AND bp=0
NewVariable = 0.

...etc etc.
 
Last edited:
Top