Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash
- Posts: 1
- Joined: Sat Dec 07, 2013 5:22 pm
I want SPSS to look at some variables (here, Mom, Dad, Sister, Brother). Let's say they're in a competition and I want to make a new set of variables (NewVar1, NewVar2, NewVar3) where NewVar1 represents the top finisher in the competition and puts the variable name of the top finisher into the cell on the row of that competition, then NewVar2 puts the second place person into its column on the row of the competition, and NewVar3 puts the variable name for the competition third place finisher. I don't care about who came in fourth.
Competition Mom Dad Sister Brother NewVar1 NewVar2 NewVar3
1 1 0 2 3 Brother Sister Mom
2 2 1 0 3 Brother Mom Dad
3 3 2 1 0 Mom Dad Sister
It could even just put a number into NV1, NV2, NV3 and then I could do variable labels, but the thing is making sure it ignores the fourth (or fifth, sixth, etc.) place finishers and gets the second and third place finishers in the right spot. I feel like the syntax is on the tip of my brain but I just can't get it...esp NewVar2 and NewVar3. Help! Thanks!
- Posts: 1477
- Joined: Tue Jun 10, 2008 4:50 pm
so how are the places in which they finish represented in your datafile?
Anyway, I think you could use if-functions:
if (mom = 1) firstplace = 1.
if (dad = 1) firstplace = 2.
if (brother = 3) thirdplace = 4.
variable labels firstplace 1 "mom" 2 "dad" 3"sister" 4"brother.
or, if you acutually want the word "mom": first make a string variable then do firstplace = "mom".
Who is online
Users browsing this forum: No registered users and 1 guest