Repository navigation
Conversation
Row-compressed files contain an extra page after the metadata (page type 0x9000). The signed 16-bit field at phs-2 of this page holds the offset to the page trailer. The writer had three problems here: - It placed the trailer at the end of the physical page. For page sizes of 32 KiB and above the field overflowed (e.g. 0xFFBE for 64 KiB pages). SAS then rejected the file with "Page header information invalid". - The trailer offsets only matched SAS for 32-bit files. - The field value only matched SAS for 64-bit files with pages below 32 KiB. The physical page size is unchanged. Beyond the trailer, the page is zero-filled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
SAS7BDAT files with row compression as currently written by ReadStat (with the default page size) are rejected by SAS with the error
The problem is in the COMP page, which was good in 2d942c3 but #417 uncovered a missing condition on the page size.
SAS saves the offset of the COMP page trailer in a signed 16-bit field so it needs to get creative for page sizes of 32 KiB and above. This PR addresses this.
Validation
The change is built on inspection of both 64-bit and 32-bit data files with compressed rows and page sizes 8KB, 16KB, 31KB, 32KB, 64KB as generated by SAS.
I've written the same set of data files with ReadStat and the proposed change, and all produced data files were accepted by SAS.