Skip to content

Don't classify user-defined SAS formats as dates by prefix - #860

Merged
hadley merged 1 commit into
mainfrom
fix-sas-date-format-prefix
Oct 21, 2026
Merged

hadley merged 1 commit into
mainfrom
fix-sas-date-format-prefix

Conversation

@hadley

@hadley hadley commented Oct 21, 2026

Copy link
Copy Markdown
Member

🤖 Written by AI 🤖

The prefix matching added in #790 classified any SAS format starting with a short date format name as a date, so a column with the user-defined format DAYSV was read as Date instead of numeric (revdep failure in libr, #859).

Short date format names (DAY, WEEK*, MON*, QTR, YEAR) now only match when followed by a width digit, a decimal point, or nothing (DAY2. matches, DAYSV doesn't). Longer unambiguous prefixes like MMDDYY keep loose matching so separator variants like MMDDYYS10. keep working.

Verified against libr's test suite, which now passes.

Short date format names (`DAY`, `WEEK*`, `MON*`, `QTR`, `YEAR`) added in #790 now only match when followed by a format width or decimal point, so a user-defined format like `DAYSV` no longer causes a numeric column to be read as `Date` (revdep failure in libr).
@hadley hadley mentioned this pull request Oct 21, 2026
17 tasks done
@hadley
hadley merged commit bffc55a into main Oct 21, 2026
13 checks passed
@hadley
hadley deleted the fix-sas-date-format-prefix branch October 21, 2026 21:13
@hadley

hadley commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

FWIW I'm planning to submit haven to CRAN on Nov 2.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant