SPSS syntax command "either... or"

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

be_good
Posts: 5
Joined: Mon Nov 28, 2011 9:50 am

SPSS syntax command "either... or"

Postby be_good » Mon Nov 28, 2011 10:00 am

Hi there

I have 4 variables with four possible values (1 - 4) each. Now I want to create an index with five values:

1 if any out of the four variables are coded 3 or higher
2 if two out of the four variables are coded 3 or higher
3 if three out of the four variables are coded 3 or higher
4 if all four variables are coded 3 or higher
else = 0.

I think i need an "either... or" operation for this matter. Who can tell me the syntax command i have to use?

Thank you.
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: SPSS syntax command "either... or"

Postby GerineL » Mon Nov 28, 2011 12:18 pm

use this:

count NEWVARNAME = var1 var2 var3 var4 (3 thru highest).
execute.
be_good
Posts: 5
Joined: Mon Nov 28, 2011 9:50 am

Re: SPSS syntax command "either... or"

Postby be_good » Mon Nov 28, 2011 2:18 pm

Thank you.

So that command means that the new variable includes values 3 and 4 of all four variables? How can i distinguish between "one of the variables coded 3 or higher" and "two of the variables coded three or higher" and "three of the variables coded three or higher" and "all four variables coded three or higher"? The command above is for the last case, right? I need commands for all other cases as well.. Sorry, i really don't know how to do it.

Thank you so much for your help!
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: SPSS syntax command "either... or"

Postby GerineL » Mon Nov 28, 2011 4:00 pm

you have to replace var1 etc. with your own variable names.

it gives you the number of variables (within the list you provided) that have a score of 3 or higher so it gives you everything you asked for.

just try it.
be_good
Posts: 5
Joined: Mon Nov 28, 2011 9:50 am

Re: SPSS syntax command "either... or"

Postby be_good » Wed Nov 30, 2011 11:49 am

Thank you so much and I'm so sorry to bother. So, i did it and it worked but I'm not sure how to interpret the output. I got the following output:

0 8
1 35
2 52
3 46
4 14
Total 155

Does that say that 8 persons quoted non of the variables to be 3 or higher, 35 persons quoted 1 out of the four variables to be 3 or higher, 52 persons quoted two of the four variables to be 3 or higher, 46 quoted three of the four variables to be 3 or higher etc.? If it is so I actually have everything I wanted!! Thank you so much!!!
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: SPSS syntax command "either... or"

Postby GerineL » Wed Nov 30, 2011 12:47 pm

you should get a variable, not "output".
be_good
Posts: 5
Joined: Mon Nov 28, 2011 9:50 am

Re: SPSS syntax command "either... or"

Postby be_good » Wed Nov 30, 2011 1:02 pm

yes I do get a new variable. I mean I get those results by calculating a frequency statistics of the new variable.
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: SPSS syntax command "either... or"

Postby GerineL » Wed Nov 30, 2011 1:15 pm

be_good wrote:Thank you so much and I'm so sorry to bother. So, i did it and it worked but I'm not sure how to interpret the output. I got the following output:

0 8
1 35
2 52
3 46
4 14
Total 155

Does that say that 8 persons quoted non of the variables to be 3 or higher, 35 persons quoted 1 out of the four variables to be 3 or higher, 52 persons quoted two of the four variables to be 3 or higher, 46 quoted three of the four variables to be 3 or higher etc.? If it is so I actually have everything I wanted!! Thank you so much!!!

yes it does.
be_good
Posts: 5
Joined: Mon Nov 28, 2011 9:50 am

Re: SPSS syntax command "either... or"

Postby be_good » Wed Nov 30, 2011 1:34 pm

perfect, thank you!!

Who is online

Users browsing this forum: No registered users and 2 guests

cron