Efficient way for converting Yes/No to 1/0 in Excel or SPSS

JavaLeave picture JavaLeave · Oct 27, 2013 · Viewed 32.3k times · Source

I am trying to find an efficient way for converting yes/no to 1/0 in Excel. Since I am doing the data analyzing at SPSS. Or if there is a way converting YES/NO to 1/0 in SPSS directly?

Answer

stobin picture stobin · Oct 27, 2013

Try this syntax in SPSS:

This will create a new field with 1 and 0. Also keep in mind that it's case sensitive.

numeric boolFieldName(f1).

recode ynFieldName ("YES" = 1) ("NO" = 0) into boolFieldName.
execute.