in SAS, when observations are “deleted,” they aren’t completely removed from the dataset but are instead marked for deletion. When reading such sas7bdat files into Python using libraries like pandas, pyreadstat, or sas7bdat, Python reads in all the observations, including those marked as deleted. However, there is no built-in indicator in these libraries to distinguish between active and deleted observations.
As a result, I’m unable to determine which observations are actually marked as deleted in SAS and should be excluded
My questions:
• Is there a way to identify deleted observations in a sas7bdat file when loading it into Python?
• Are there any tools, workarounds, or additional SAS preprocessing steps that can help identify and remove these deleted observations before or during the import process in Python?
Any guidance on handling these “deleted” rows would be greatly appreciated!
. I’ve tried the following approaches
1.Using pandas.read_sas(): Reads in the entire dataset, including deleted observations, without any indication of deletion. 2. Using pyreadstat: While pyreadstat.read_sas7bdat() can read compressed and uncompressed files, it also lacks support for distinguishing deleted rows.