Hi,
I gotten the sasdata from someone else, but not able to execute or view the sasdata via SAS EG or SAS Base. The error message that I got is as per below:
The pc. library is located in my D drive.
58
59 data Car_v2_avph;
60 set pc.Car_v2_avph;
ERROR: File PC.CAR_V2_AVPH.DATA is not a SAS data set.
61 run;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.CAR_V2_AVPH may be incomplete. When this step was stopped there were
0 observations and 0 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
I am able to view the data from the sas Explorer.
Below is the sasdata properties if i open from my local D drive.
Please assist if I can save this data
1F9D is the magic number for the .Z file format, which is created by the UNIX compress utility.
Run uncompress and see if you can use the result; if that is not the case, run tar -tf uncompressed_file to check if it is actually a tar archive.
Was the dataset created on same OS type as the SAS EG ? (Windows / unix or linox )
Yes, is created under same OS, which is Window. But it created in Y2014, is an old sasdata, we are retrieving it for our analysis .
Try using a legacy library engine and see if the data content is accessible.
LIBNAME WAYBACK V8 'D:\Data';
How was the data set file (the .sas7bdat) 'gotten' or otherwise delivered to you ?
- FTP may have converted characters
- A text editor or other file editor may have been used to look at the file and accidentally overwritten it
- File could have be retrieved from an archiving application using incorrect settings or environment variables
Is it possible they used PROC CPORT to create a file with an incorrect filename extension ?
Have you looked at the file with a Hex viewer? Example sashelp.cars file in Hex Editor Neo
I @RichardDeVen is probably on the right track. Is the original file available anywhere? If you can get back to the original file, you may be OK. If it was FTP'd to you and they used ASCII mode, then the file could be corrupted. There are other ways that the file can be corrupted such as, as @RichardDeVen suggests, opening in in an editor window and accidentally saving it. Again, if the original file is still available or can somehow be pulled back from archive, you may be OK. I think the version that you have may be unreadable even though SAS can "see" it.
Jim
Actually the popup windows shown by @alice_cimb doesn't show that it is/was, a sas dataset, corrupted or not. I can reproduce the same popups just by renaming a .TXT file to have a .sas7bdat extension and right-clicking. It's just the o/s and sas making an inference based on the extension. The failure only occurs when asking sas to look inside.
Have checked with the person who passed me the data. The data was retrieved from archived folder, and should be corrupted when they extracted it. This is a monthly generate data, only those data that extracted from archived folder are impacted, while some of the original dataset which is not in keep in archived still can be used.
I have ask them to try to re-extract from the archived folder using others tools. But if this fail again, what can I do to save the file? Can I open the data using another tools and import to text or csv?
Below is the data view in Hex view, please advice what can i do about it?
Thanks
Well, I can't say for 100% sure, but that hex display of the SAS dataset doesn't look good. I would expect to see a few things that were intelligible, but I don't see any in your hex file. For example, here's a random SAS data set from my system. Much of it looks like junk, but I can make out "SAS FILESUMMARY," "DATA," and "9.0401M6X64_SRV16."
Âê`³Ï½’ Ç1Œ"" 332 "" 3323#3 > SAS FILESUMMARY DATA ºIüˆÌwÜAºIüˆÌwÜA ”ÑÀ ”ÑÀ 9.0401M6X64_SRV16 ºIüˆö“íö“íö“í €'] ºIüˆÌwÜA
I hope I'm wrong, but the hex display of your file doesn't look promising.
Jim
1F 9D is a 'magic number' associated with tar zip (.z or tar.z files). Try to untar the file and then unzip that (or unzip then untar). With any luck you will get your actual data set out the end.
Okay, will try that, thanks~!
1F9D is the magic number for the .Z file format, which is created by the UNIX compress utility.
Run uncompress and see if you can use the result; if that is not the case, run tar -tf uncompressed_file to check if it is actually a tar archive.
Thanks @Kurt and all, based on your advice, the problem is solved. We modified the file name by adding .Z at behind (car_v2_avph.sas7bdat.Z ) and uncompress the file.
Thanks for the help~!
I would go back to the "someone else" and discuss what may have been done with this file.
What version of SAS are you currently running? And which version created the data set (probably have to get that from "someone else")? If by any chance you are using SAS 9.2, especially a 32-bit version, or earlier and the set was made with a more recent version this can happen because of changes to the data set header information.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.