ReadStat icon indicating copy to clipboard operation
ReadStat copied to clipboard

Reading sas7bdat gets "A row in the file was not the expected length"

Open jhen1115 opened this issue 2 years ago • 1 comments

Hi,

When using R haven package version 2.5.4 (ReadStat version 1.1.9), getting the below errors: ReadStat: Row #0 decompressed to -1 bytes (expected 8264 bytes) ReadStat: Error parsing page 0, bytes 8192-73727 Error: Failed to parse dummy_data_set_8256.sas7bdat: A row in the file was not the expected length.

The SAS data set consists of two variables: TEST1 (a numeric variable with length 8, containing missing value) and TEST2 (a character variable with length 8256, containing 8256 characters which repeat the string 'test' 2064 times). However, if any of following modifications are made to the data set, it can be read without errors:

  • Removal of TEST1
  • Removal of TEST2
  • Changing the string of TEST2 to remove the tailing 'est' (8253 characters)
  • Changing the string of TEST2 to 'a' (8256 characters) by repeating the character 'a' 8256 times

Could you please help to investigate the issue and provide a resolution?

Thank you.

jhen1115 avatar Dec 07 '23 15:12 jhen1115

Hi, I know it's been a long time but can you share the file that's causing an error?

evanmiller avatar May 23 '25 17:05 evanmiller