0

I am trying to recode a new variable out of two variables in my dataset. I don't see how I could create a MWE for SPSS, so I will just describe my data and hope that you are still able to follow me. If you let me know how to create a MWE for SPSS, I'd be happy to provide it.

I asked respondents about language knowledge. In the survey, I used a table listing 3 specific languages and a scale of knowledge (1-4 and 5 = "don't know"), as well as a fourth language "other" + fill in which one and how well you speak it.

I would like to create a new variable by extracting just the people who wrote in "Chinese" in the "other" category and have this new variable have a scale from 1-5, 1-4 being the skill level and 5 being "don't know" for all those who did not indicate Chinese (I am aware that since respondents were only able to indicate one "other" language, they were forced to choose one language and might actually speak Chinese next to the language they indicated - but let's bracket that concern for now).

eli-k
  • 10,898
  • 11
  • 40
  • 44
Tea Tree
  • 882
  • 11
  • 26
  • to create an example look up `data list` command (you can see an example in my answer [here](https://stackoverflow.com/questions/52204173/change-rows-to-columns-based-on-key-ids/52205088#52205088)) – eli-k Sep 25 '18 at 07:01

1 Answers1

1

If I understand your description, this should do the job:

do if otherLangName = "Chinese".
  compute chineseLevel = otherLangLevel.
else.
  compute chineseLevel = 5.
end if.
eli-k
  • 10,898
  • 11
  • 40
  • 44