Repository navigation
Fix writing of SAS missing values - #416
Merged
Merged
Conversation
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.
ReadStat currently writes SAS numeric missing values (
.,._,.A–.Z) to.sas7bdatfiles in a way SAS doesn't understand. The writer puts the inverted ASCII tag character into a standard quiet NaN (0x7FF8…), which isn't the NaN value that SAS actually expects as a basis.The
readstatCLI also drops tagged missing values when writing.sas7bdat: values are never passed toreadstat_insert_tagged_missing_value.Changes
src/sas/readstat_sas7bdat_write.c: missing values are now encoded the way SAS stores them:0xFF 0xFF.._→ 0,.→ 1,.A–.Z→ 2–27.src/bin/write/mod_readstat.c: tagged missing values are now written throughreadstat_insert_tagged_missing_valuewhen the output is.sas7bdat, as already done for.dta.Verification
.sas7bdatfiles containing.,._and.A–.Zwere converted withreadstat in.sas7bdat out.sas7bdat. The output opens in SAS and shows the same missing values as the original. Before this change, none of the missing values survived.