tidyverse / haven

Read SPSS, Stata and SAS files from R
https://haven.tidyverse.org
Other
423 stars 115 forks source link

`haven::read_sas()` unable to allocate memory for <16MB SAS page sizes #705

Closed DanChaltiel closed 1 year ago

DanChaltiel commented 1 year ago

The same problem as in #697 can also happen with <16MB catalogs if one of the formats is considered invalid. It is a kind of a corner case but I guess it can provide some information.

For instance, I have to add the following format to my catalog so that my .sas7bdat file is readable with SAS, but this unfortunately fails with haven:

libname catout 'your/path';
Proc format lib=catout;
Value $ate ;
run;

This SAS code creates a formats.sasb7cat catalog file (link) that weighs only 17ko.

Using read_sas(input, catalog) with this catalog file will output the following error, regardless of the input .sas7bdat file:

Failed to parse xxx.sas7bdat: Unable to allocate memory.

I'm not sure whether this relates to ReadStats so I posted it here, sorry if this was not the thing to do.

gorcha commented 1 year ago

Hi @DanChaltiel, are you able to provide a corresponding sas7bdat file I can use to test?

DanChaltiel commented 1 year ago

Hi @gorcha, unfortunately, all my sas7bdat files are proprietary and cannot be shared online. However, I tested with a few and this happened each so you might want to give it a try with the first dummy file you find. If you cannot reproduce the error, I will try to find a file that does not contain any sensitive information but I'm not sure it even exists.

gorcha commented 1 year ago

Hey @DanChaltiel, no worries at all - it look like I'm able to reproduce the error using any sas7bdat file anyway so all good. Thanks!