-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sav variable display width becomes 0 if string variables longer than 255 characters #210
Comments
Thank you for the report. Please try 03ba85c |
it works! thanks! Just one more question: it seems that the max value is 255, if I enter something higher it goes back to 255. Is that intentional? (SPSS does accet widths larger than 255) |
The display width is stored in two separate places. In the "legacy" location the width is limited to 255. In the new location there is no limit. I will need to tinker with it some more to make sure the proper location is used. |
Can you provide a test case and ensure you are using the latest code? My tests pass using display widths of e.g. 1000. |
hmm, attached the python script I am using, and the resulting file, setting it to 1000 and I recover 255 from readstat_variable_get_display_width (I am also printing the call to readstat_variable_get_display_width internally, not in the script, Im printing just below this line PSPP in the other hand says it is correct (1000) ... so now I am confused |
Try this 3fe313f It looks like the display record was not being read correctly with long strings. I didn't notice this before because the function's return value was never checked (and short strings were fine). |
yes, that fully solves it! thanks! |
I am using readstat_variable_set_display_width to set the variable display width when writing a sav file. It is working, meaning when reading the written file I can get the display variable width with readstat_variable_get_display_width and it looks correct.
However if the dataset contains a value which is a string with 256 characters or more, writing it and reading again, then when using readstat_variable_get_display_width I get 0, interestingly not only for the variable containing the long string, but for any other variable in the dataset.
The long string itself is read correctly.
The text was updated successfully, but these errors were encountered: