New variable syntax

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

kristen
Posts: 1
Joined: Wed May 17, 2017 5:54 pm

New variable syntax

Postby kristen » Wed May 17, 2017 6:12 pm

Hi,

I'm trying to recode several dichotomous variables (education degrees; yes, no) into one categorical variable (highest education). The issue is that subjects were able to check more than one dichotomous variable (education type) and my syntax is not working. Any suggestions would be helpful. Syntax is below.

thanks

COMPUTE education=0.
IF (w11_1=1 and w11_2=0 and w11_3=0 and w11_4=0 and w11_5=0 and w11_6=0 and w11A=0) education=1.
IF (w11_1=0 or w11_1=1 and w11_2=1 and w11_3=0 and w11_4=0 and w11_5=0 and w11_6=0 and w11A=0) education=2.
IF (w11_1=0 or w11_1=1 and w11_2=0 or w11_2=1 and w11_3=1 and w11_4=0 and w11_5=0 and w11_6=0 and w11A=0) education=3.
IF (w11_1=0 or w11_1=1 and w11_2=0 or w11_2=1 and w11_3=0 or w11_3=1 and w11_4=1 and w11_5=0 and w11_6=0 and w11A=0) education=4.
IF (w11_1=0 or w11_1=1 and w11_2=0 or w11_2=1 and w11_3=0 or w11_3=1 and w11_4=0 or w11_4=1 and w11_5=1 and w11_6=0 and w11A=0) education=5.
IF (w11_1=0 or w11_1=1 and w11_2=0 or w11_2=1 and w11_3=0 or w11_3=1 and w11_4=0 or w11_4=1 and w11_5=0 or w11_5=1 and w11_6=1 and w11A=0) education=6.
IF (w11_1=0 or w11_1=1 and w11_2=0 or w11_2=1 and w11_3=0 or w11_3=1 and w11_4=0 or w11_4=1 and w11_5=0 or w11_5=1 and w11_6=0 or w11_6=1 and w11A=0) education=7.
EXECUTE.

Who is online

Users browsing this forum: No registered users and 3 guests

cron