mardi 18 octobre 2016

Creating a New Variable in SPSS with a Value Equal to Another Variable

I apologize for the confusing title. Essentially, the intended functionality in SPSS is working with the following data file:

Monday     Tuesday     Wednesday     Day of Interest    Temperature on Day of interest
72         78          80            2                    

Here we have three variables and then the temperature for each of those days. The goal is to create a new variable, in the example it's Temperature on Day of Interest, that has the same value as the day it corresponds to (e.g. The second day of the week is a Monday, so we want to temperature on Monday in the new variable column).

My thoughts are that I can use an If statement, but I'm not sure on exactly how the syntax would be in SPSS. Here is what I have written:

IF (Day of Interest = 2) Temperature on Day of Interest = $Monday.
IF (Day of Interest = 3) Temperature on Day of Interest = $Tuesday. 

Does anyone happen to know how to properly reference the value in various variables in this manner? I hope this is clear, I'll be able to answer any questions!

Aucun commentaire:

Enregistrer un commentaire