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

SAS Exporter - 2 Issues: Exhibits infinite growth; Crashes R; #234

michaelwhammer opened this Issue Oct 28, 2016 · 3 comments


None yet
3 participants
Copy link

michaelwhammer commented Oct 28, 2016

There are several data sets that I work with that I am unable to export using haven. The R session either crashes or the export never finishes (and the size of exported file continues to grow into the GB/TB realm even when the data is relatively small).

Unable to export to SAS:

Unable to export to SPSS:

I am using:
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

@hadley hadley added the reprex label Jan 25, 2017

@michaelwhammer michaelwhammer changed the title Exporting to SPSS & SAS: Crashes / Stuck SAS Exporter - 2 Issues: Exhibits infinite growth; Crashes R; Jan 27, 2017


This comment has been minimized.

Copy link

hadley commented Jan 30, 2017

Slightly cleaned up reprex below.

@evanmiller I still see both issues on latest haven.


zip_path <- tempfile()
download.file("", zip_path)
rdata_path <- unzip(zip_path, exdir = basename(zip_path))

# sas_df1 - Gets stuck in loop
haven::write_sas(sas_df1, tempfile())

# sas_df2 - Crashes R
haven::write_sas(sas_df2, tempfile())

# sas_df3 - Gets stuck in loop
haven::write_sas(sas_df3,  tempfile())

I've cleaned up the issue title/comment thread to focus on key components of problem. Thanks for the correspondence so far 😄

@hadley hadley added bug readstat and removed reprex labels Jan 30, 2017


This comment has been minimized.

Copy link

evanmiller commented Jan 30, 2017

sas_df2 is a divide-by-zero crash:

Exception Type:        EXC_ARITHMETIC (SIGFPE)
Exception Codes:       EXC_I386_DIV (divide by zero)
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Floating point exception: 8
Termination Reason:    Namespace SIGNAL, Code 0x8
Terminating Process:   exc handler [0]

Thread 0 Crashed:: Dispatch queue:
0                      	0x00000001100218ab sas7bdat_emit_header_and_meta_pages + 315
1                      	0x00000001100215e4 sas7bdat_begin_data + 2292
2                      	0x000000011001be55 readstat_begin_row + 165
3                      	0x0000000110044645 Writer::write() + 1269
4                      	0x0000000110044dd6 write_sas_(Rcpp::Vector<19, Rcpp::PreserveStorage>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) + 70
5                      	0x0000000110049c2f haven_write_sas_ + 175

All issues appear to be related to rows not fitting into the default (and, currently, only possible) page size of 4096 bytes. Per #270 it looks like rows longer than 2048 bytes cause a hang, and rows longer than 4096 bytes cause a crash.


This comment has been minimized.

Copy link

evanmiller commented Jan 30, 2017

@hadley Should be "fixed" (return error instead of crash/hang) by WizardMac/ReadStat@7d9d580

@hadley hadley closed this in 330c873 Jan 31, 2017

@lock lock bot locked and limited conversation to collaborators Jun 26, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.