Skip to content

write_dta can't write labelled doubles with decimal values  #401

Closed

Description

Hello - please apologize if I'm doing something wrong, I'm a newbie. I'll try my best.

The issue: Until recently, write_dta couldn't write labelled doubles even if all values of a variable were integers. As far as know, the issue (#343) was fixed.

However, write_dta still won't write labelled doubles if certain values have decimal values --> Even if these values do not have labels.

Minimal example:

x <- data.frame(
  a=labelled(c(-7, -8, 1, 2, 3), labels=c("refuse" = -7, "don't know" = -8)),
  b=labelled(c(-7, -8, 1, 2, 3. 2), labels=c("refuse" = -7, "don't know" = -8))
)
write_dta(x, "test.dta")

I think those variables should be supported since many (survey) variables include data with decimal values (e.g., hourly wages) but still need to label certain values (refuse, does not apply...). Of course I see the point why labelled values don't need decimal points.

By the way: With write_sav, this works fine.

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

Metadata

Assignees

No one assigned

    Labels

    reprexneeds a minimal reproducible example

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions