I'm trying to access '\\server\folder\file_name.sas7bdat', but I'm getting a data set error.
For example,
libname data '\\server\folder';
proc contents data=data._all_;
run;
output
ERROR: File DATA.FILE_NAME.DATA is not a SAS data set.
The properties of the file says it is a SAS Data Set (.sas7bdat), so I'm not sure what's going on.
EDIT: Added libname statement and filepath.
You might show the libname statement you used to create the DATA library where you placed the data set.
Other SAS data sets in this library do not generate this error.
@publicSynechism wrote:
Other SAS data sets in this library do not generate this error.
That doesn't make sense. Your code actually is referencing a library not a data set.
proc contents data = data._all_ ;
run;
To access a data set perhaps try and explicitly referencing it?
If this doesn't work, please post your full log.
proc contents data=data.file_name;
run;
For this log, I used proc contents on two separate files.
\\server\folder\file_name.sas7bdat
\\server\folder\other_file.sas7bdat
libname data '\\server\folder';
proc contents data=data.other_file;
run;
proc contents data=data.file_name;
run;
1 libname data
1 ! '\\server\folder;
NOTE: Libref DATA was successfully assigned as follows:
Engine: V9
Physical Name:
\\server\folder
2
3 proc contents data=data.other_file;
NOTE: Writing HTML Body file: sashtml.htm
NOTE: Data file DATA.OTHER_FILE.DATA is in a format that is native to another host, or the file
encoding does not match the session encoding. Cross Environment Data Access will be used, which
might require additional CPU resources and might reduce performance.
4 run;
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.66 seconds
cpu time 0.56 seconds
5
6 proc contents data=data.file_name;
ERROR: File DATA.FILE_NAME.DATA is not a SAS data set.
7 run;
NOTE: Statements not processed because of errors noted above.
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
NOTE: The SAS System stopped processing this step because of errors.
The real log will usually indicate something that would tell why this doesn't work. It could be you have spaces in the name, it could be case sensitive. Try renaming the file to a name that's all lower case and try that.
@publicSynechism wrote:
For this log, I used proc contents on two separate files.
\\server\folder\file_name.sas7bdat
\\server\folder\other_file.sas7bdat
libname data '\\server\folder';
proc contents data=data.other_file;
run;
proc contents data=data.file_name;
run;
1 libname data
1 ! '\\server\folder;
NOTE: Libref DATA was successfully assigned as follows:
Engine: V9
Physical Name:
\\server\folder
2
3 proc contents data=data.other_file;
NOTE: Writing HTML Body file: sashtml.htm
NOTE: Data file DATA.OTHER_FILE.DATA is in a format that is native to another host, or the file
encoding does not match the session encoding. Cross Environment Data Access will be used, which
might require additional CPU resources and might reduce performance.
4 run;
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.66 seconds
cpu time 0.56 seconds
5
6 proc contents data=data.file_name;
ERROR: File DATA.FILE_NAME.DATA is not a SAS data set.
7 run;
NOTE: Statements not processed because of errors noted above.
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
NOTE: The SAS System stopped processing this step because of errors.
libname data '\\server\folder';
proc contents data=data.otherfile;
run;
proc contents data=data.filename;
run;
8 libname data
8 ! '\\server\folder';
NOTE: Libref DATA was successfully assigned as follows:
Engine: V9
Physical Name:
\\server\folder
9
10 proc contents data=data.otherfile;
NOTE: Data file DATA.OTHERFILE.DATA is in a format that is native to another host, or the file
encoding does not match the session encoding. Cross Environment Data Access will be used, which
might require additional CPU resources and might reduce performance.
11 run;
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.16 seconds
cpu time 0.10 seconds
12
13 proc contents data=data.filename;
ERROR: File DATA.FILENAME.DATA is not a SAS data set.
14 run;
NOTE: Statements not processed because of errors noted above.
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
NOTE: The SAS System stopped processing this step because of errors
Yeah, unfortunately it's only stating it's not a SAS data set. Both files are of the same format and from the same source (supposedly). Not sure why the one works and the other does not.
The message seems pretty clear. That file with the .sas7bdat extension is NOT a SAS dataset. It is either corrupted or it is some other type of file that just has the wrong extension.
It must be. Just wanted to make sure I wasn't overlooking something. I'll contact the group that prepared the dataset. Thank you everyone for their input.
@publicSynechism wrote:
It must be. Just wanted to make sure I wasn't overlooking something. I'll contact the group that prepared the dataset. Thank you everyone for their input.
Unfortunately there are some individuals that are in the habit of confusing things by giving files extensions that do not actually match the content, though I usually see that in regards to files used with Excel. These folks think that naming a CSV (or html or xml or …) file with XLS or XLSX extension is okay because Excel then opens the file. Perhaps someone did that in this case with a text file or other file format without realizing that the header information in the file is "different".
Good luck and I hope you can get a usable data set.
Look at the beginning of the file and see if it looks like a SAS dataset. Compare it to the beginning of the file that works.
data _null_;
infile "%sysfunc(pathname(data))/other_file.sas7bdat" recfm=f lrecl=80 obs=3 ;
input;
list;
run;
data _null_;
infile "%sysfunc(pathname(data))/file_name.sas7bdat" recfm=f lrecl=80 obs=3 ;
input;
list;
run;
So apparently some software upgrade caused the SAS dataset to be corrupted during file transfer. As to the specifics of that, I do not know, but importing a CSV version of the file was successful. Thank you to everyone for troubleshooting with me. Thanks Tom, I'll try that in the future if I run into a similar problem.
It could be that the offending SAS dataset was created under a different operating system, then just moved to a new SAS server using a file copy. This could produce the symptoms you are seeing.
Interesting. What is it about the data set or the OS that causes that problem?
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!
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.