Skip to content

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

Description

@jhen1115

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.

Activity

  1. evanmiller commented on May 23, 2025

    @evanmiller
    Contributor

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

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