Skip to content

SPSS fails to read value labels for ordered factors #285

Closed
@gitrman

Description

@gitrman

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:

data_view

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".

variable_view

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions