-
Notifications
You must be signed in to change notification settings - Fork 63
SAS7BDAT file not readable #284
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
Comments
pyreadstat version == 1.2.8 |
Traceback (most recent call last): |
thanks for the report. The problem seems to be coming from the underlaying C library Readstat. Feel free to report the issue there, it needs to be solved there first. It is unlikely that it is an encoding issue. |
reported in WizardMac/ReadStat#336 |
reading ae.sas7bdat solved on dev! feel free to test. Regarding why sample.sas7bdat is not opening in your viewer, I don't know, that file was generated on SAS, so if it does not open, that is a problem beyond the scope of this project. |
Possibly related to this: https://pharmasug.org/proceedings/2018/EP/PharmaSUG-2018-EP08.pdf "The first question to ask is why SAS System Viewers cannot open datasets generated in SAS 9.4 ..." |
`import pyreadstat
file_path = r"C:\Users\YaoPeng\AppData\Local\Temp\raw_data\ae.sas7bdat"
encodings = ["utf-8", "gbk", "gb2312", "cp1252", "latin1", "iso-8859-1", "utf-16"]
for enc in encodings:
try:
df, meta = pyreadstat.read_sas7bdat(file_path, metadataonly=True)
print("Metadata read successfully, column name:", meta.column_names)
except Exception as e:
print("Metadata read failure, error message:", str(e))
print(f"Encoding {enc} failed")`
ae.zip
Hi! As shown in Figure 1, this is a sas7bdat data that I opened in variable view with the SAS System Viewer software, and I want to get this data, using python, Python 3.9.13,But running the appeal code results in an error,Error prompt
:Metadata read failure, error message: Invalid file, or file has unsupported features,And attempts to implement multiple encoding formats have failed.However, I downloaded the official test file sample.sas7bdat from the git hub to run this code. So why is my own ae.sas7bdat file running this code error? In addition, their own ae.sas7bdat file can also be opened normally by SAS System Viewer software, but the official test file sample.sas7bdat cannot be opened normally by SAS System Viewer software.Tips as shown in Figure 2
The text was updated successfully, but these errors were encountered: