-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Detect CPORT header in SAS files #44300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ def setup_method(self, datapath): | |
self.file02 = os.path.join(self.dirpath, "SSHSV1_A.xpt") | ||
self.file03 = os.path.join(self.dirpath, "DRXFCD_G.xpt") | ||
self.file04 = os.path.join(self.dirpath, "paxraw_d_short.xpt") | ||
self.file05 = os.path.join(self.dirpath, "DEMO_PUF.cpt") | ||
|
||
with td.file_leak_context(): | ||
yield | ||
|
@@ -157,3 +158,11 @@ def test_truncated_float_support(self): | |
|
||
data = read_sas(self.file04, format="xport") | ||
tm.assert_frame_equal(data.astype("int64"), data_csv) | ||
|
||
def test_cport_header_found_raises(self): | ||
# Test with DEMO_PUF.cpt, the beginning of puf2019_1_fall.xpt | ||
# from https://www.cms.gov/files/zip/puf2019.zip | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this public domain or similar? If not, might be good to have someone create a CPT file from scratch. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's publicly available data (from the US government's CMS, stored at https://www.cms.gov/files/zip/puf2019.zip). I don't have SAS so can't create a file. But the compressed CPORT files will have |
||
# (despite the extension, it's a cpt file) | ||
msg = "Header record indicates a CPORT file, which is not readable." | ||
with pytest.raises(ValueError, match=msg): | ||
read_sas(self.file05, format="xport") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this value in any file format document provided by SAS? If so, would be good to include a reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I've added it in a new commit