-
Notifications
You must be signed in to change notification settings - Fork 116
Description
SPSS is unable to read value labels for ordered factors -- whereas unordered factors are fine.
A minimal example:
x <- c("a", "b", "c")
df <- data.frame(
v1 = factor(x),
v2 = factor(x, ordered = TRUE)
)
library(haven)
write_sav(df, "df.sav")
Here is a screenshot of the SPSS Data View tab after I open the file in SPSS:
v1 and v2 should look identical - however for v2 the numeric values rather than the factor labels are displayed.
On the SPSS Variable View tab, for the unordered factor v1, SPSS correctly displays the measure type as Nominal and the value labels are listed correctly in the Values column. Whereas for the ordered factor v2, SPSS displays the correct measure type (Ordinal), but the value labels have been erroneously set to "None".
I am using the development version of Haven from github (haven_1.0.0.9000), Windows 10, and SPSS 22. I have also experienced this error on machines running Windows 7 and earlier versions of Haven.

