ReadStat icon indicating copy to clipboard operation
ReadStat copied to clipboard

long string variable split when reading in SPSS

Open ofajardo opened this issue 4 years ago • 4 comments

hi

When writing a sav SPSS file with Readstat containing long string variables (long_readstat.sav), Readstat reads them correctly, however SPSS splits it (LongString2, "V2_A1", "V2_A2", "V2_A3"), this does not happen if the name of the variable is shorter (LongStr instead of LongString2). For comparison the same content but written with SPSS (long_spss.sav) it opens correctly both in SPSS and Readstat.

original reports: https://github.com/Roche/pyreadstat/issues/119 https://github.com/Roche/pyreadstat/issues/118

longstring.zip

ofajardo avatar Apr 02 '21 13:04 ofajardo

I experience the same problem. Can someone please have a look at this?

mtr avatar Jun 10 '21 14:06 mtr

Interesting. It looks like SPSS is using internal names LONGS0, LONGS1, LONGS2 rather than V2_A etc. It looks like the variable-naming algorithm needs to be updated.

evanmiller avatar Jan 15 '23 20:01 evanmiller

solved in version 1.1.9

ofajardo avatar Feb 23 '23 14:02 ofajardo

I was made aware that the issue is gone when reading the file with Pyreadstat, however, the issue is still there when reading the file with SPSS. Actually I forgot about this difference, now I notice that even I wrote at the first description of this issue that Readstat reads correctly but SPSS does not.

ofajardo avatar Feb 23 '23 16:02 ofajardo