haven icon indicating copy to clipboard operation
haven copied to clipboard

read_sas() fails to parse sas7bdat file since v2.2.0

Open kforner opened this issue 1 year ago • 1 comments

We have a file (from a customer) that can be successfully parsed by haven up to version 2.2.0 (included), and fails starting from version 2.3.0:

> haven::read_sas('/tmp/toto')
Error in df_parse_sas_file(spec_data, spec_cat, encoding = encoding, catalog_encoding = catalog_encoding,  : 
  Failed to parse /tmp/toto: Invalid file, or file has unsupported features.

Unfortunately we can not for now provide a reprex. But in the header there is this string 7.00.00BWIN_95, probably the OS version. We will try to provide a sample file, but in the meantime, is there any change between those 2 versions (I suppose in readstat) that could explain this error ?

kforner avatar Aug 29 '22 08:08 kforner

Hi @kforner, thanks for the report. There were a few changes to the SAS reading code in readstat in that release so this is almost certainly related, but there's nothing that screams out on a first glance.

Unfortunately it's not really possible to investigate without a reprex (particularly with SAS files since there's no solid file format specification), so if there is a way you can provide a file to check it would be very much appreciated.

gorcha avatar Sep 01 '22 02:09 gorcha

I've closed this issue due to lack of requested reprex. If you still care about this bug, please open a new issue with a reprex.

hadley avatar Oct 31 '23 17:10 hadley