Repository navigation
add feature to read xpt / cport files - #446
Open
tbugfinder wants to merge 2 commits into
Open
tbugfinder wants to merge 2 commits into
tbugfinder wants to merge 2 commits into
Conversation
SAS CPORT transport files (PROC CPORT) are often named .xpt, but are a different, undocumented format, so readstat_parse_xport() failed on them with a generic parse error. It now recognises them by their first record (the "**COMPRESSED**" banner or "LIB CONTROL") and reads them with a new reader in src/sas/readstat_cport_read.c: - compressed and NOCOMPRESS files (blank/NUL run-length coding with 0xBC as the escape byte) - the first dataset member of a library; catalog members are skipped - variable names, labels, formats, informats, the dataset label and the row count from the member header - values in the XPORT layout (IBM floats, special missing values) - the session encoding (utf8, wlt1) when no input encoding is set The layout was worked out from files written by SAS 9.4 (Windows, WLATIN1) and SAS Viya 4 (Linux, UTF-8). Three of them are added to resources/ as test files; the OS release field of cport_basic_win94.xpt, which held stale bytes, was blanked. Further cases (catalogs, index and sort spans, long labels, runs across records, truncated and corrupt files) are built in memory by test_xport_cport(). Fixes WizardMac#187. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SAS CPORT files also turn up as .cpt or .cport. Read them through the XPORT reader like .xpt files. They are input only: the output modules still decide which extensions can be written, and the usage text, man page and README list them as input formats only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
This PR introduces the feature to read xpt - cport type of files.
closes: #187