BUG: fix read_sas large datetimes off by 2 days (GH#56014)#64344
Open
jbrockmendel wants to merge 4 commits intopandas-dev:mainfrom
Open
BUG: fix read_sas large datetimes off by 2 days (GH#56014)#64344jbrockmendel wants to merge 4 commits intopandas-dev:mainfrom
jbrockmendel wants to merge 4 commits intopandas-dev:mainfrom
Conversation
SAS uses a modified Gregorian calendar where years divisible by 4000 are not leap years. Between 1960 and 9999 there are two such years (4000 and 8000), causing a 2-day offset for max-range SAS dates. Apply an additive correction in _convert_datetimes before casting to datetime64, restoring agreement with real SAS 9.4 output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0bbd556 to
667daad
Compare
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.
After a few false starts, claude figured out:
This adds a correction function
_sas_to_gregorian_correctionso that we match the results SAS produces natively.Claude wrote this, I reviewed it manually.