I had a scheduled job that failed in the middle of an append step to this specific table due to a SAS outage. Now the table is corrupted/broken, and I'd love to be able to repair it, as it has stored data that I might not be able to recreate via a total rerun.
I have tried:
PROC DATASETS LIBRARY=HAVE MEMTYPE=DATA;
REPAIR BROKEN_TABLE;
RUN;
with and without the memtype option, and errors fall along the line of:
"Expecting page 123456, got page -1 instead."
"Page validation error while reading HAVE.BROKEN_TABLE.DATA."
"File HAVE.BROKEN_TABLE.DATA is damaged. I/O processing did not complete."
"Library member HAVE.BROKEN_TABLE.DATA could not be repaired."
Should I just give up on the table or are there other options I can try? Thank you 🙂
What exactly do you mean by a "SAS outage"? Did a server crash? Network fail? Symptoms (other than your append not completing).
If SAS crashes typically there is folder (where depends on installation) that has the work library and utility files, such as might be involved in an append. It might be possible to recover something from there.
No repair tool is going to fix data that is totally missing from your table. Your best bet would be to get your IT admin folks to restore from a backup taken before the dataset got damaged.
Is it possible to just salvage the non missing/broken pieces of the table? It still has most, if not all, of its size.
What happens if you try to read it? You may find you can read the table up to a certain point. Let's say your table is damaged at row 101, then this might work.
data want;
set have (obs = 100);
run;
If reading the undamaged portion doesn't work then I recommend the "restore from backup" option. If you don't have backups then I suggest it's time to ensure that this happens going forwards. I've lost count of the number of times backups have helped me.
@SASKiwi wrote:
I've lost count of the number of times backups have helped me.
Amen to that.
Been there, done that, have a closet full of T-shirts.
All my data (professional and personal) will always reside on several separate media.
Do this:
data salvage;
set damaged;
run;
and see how long it runs, and if the new dataset has observations. Post the complete log from that (all code and messages).
Typically if running SAS jobs gets stopped for whatever reason, , the temporary files of that job will continue to exist in the SAS WORK library until they are deleted / cleaned up.
Scheduled jobs typically create log files at some other permanent location. If this is applicable to your case too, using this log file you can identify the corresponding files from the SAS WORK library and the best option would be to re run the remaining steps.
You may try using R or Python to read data from that corrupt dataset.
As the job has failed while running, there would nothing to restore from the backup.
Restoration from backup may give the files from previous run.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.