recoding based on IF statement

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

njohn
Posts: 8
Joined: Fri Oct 24, 2008 4:19 pm

recoding based on IF statement

Postby njohn » Wed Nov 05, 2008 12:56 pm

In a survey I carried out, I asked people a multiple response question about impact.
The first 3 answers were types of impact; the 4th was "no impact".
I set these questions up as 4 dummy variables, with values of 0 or 1.
I have about 75 such questions about impact.
Some respondents said that there might be a type 1, 2, or 3 impact AND no impact. We want to find these people and change their "no impact" answer from 1 to 0.
I can do this on a question by question basis using Recode into same variables and an IF statement (do the recode if (impact1=1 OR impact2=1 OR impact3=1)).
But I want to do it using syntax, because I have so many to do...
Or perhaps by filtering out cases based on and IF statement?
Any clever ideas anyone?
Fierce
Moderator
Posts: 391
Joined: Sun Dec 28, 2008 5:55 pm
Location: Belo Horizonte, Brasil

Postby Fierce » Fri Jan 02, 2009 12:43 am

Code: Select all

DO IF ((<1st VARIABLE>=1 or <2nd VARIABLE>=1 or <3rd VARIABLE>=1) and <4th VARIABLE>=1).
RECODE <4th VARIABLE> (1=0).
END IF.
EXECUTE.
Last edited by Fierce on Mon Jan 05, 2009 11:33 pm, edited 1 time in total.
njohn
Posts: 8
Joined: Fri Oct 24, 2008 4:19 pm

Postby njohn » Fri Jan 02, 2009 9:54 am

Thanks a lot!

Who is online

Users browsing this forum: No registered users and 1 guest

cron