This is my first time ever doing this. Yet I was given the code for it and I'm not sure why it's not working. I'm trying to read in a permanent SAS data set and analyze the data. I put the data set into the folder I'm using, wrote down the exact code my professor gave us and I get the error message that the file does not exist. It's in my folder I assure you so I'm not sure what could be wrong. Yet, I've never done this before, I usually just import excel files into SAS so I don't understand what could be wrong. Here is my code, I hid my pathway:
libname session1 "C:\x";
data one;
set session1.hmda_subset_rev19;
proc conents;
run;
This is what's in the log:
libname session1 "C:\x";
NOTE: Libref SESSION1 was successfully assigned as follows:
Engine: V9
Physical Name: C:\x
2 data one;
3 set session1.hmda_subset_rev19;
ERROR: File SESSION1.HMDA_SUBSET_REV19.DATA does not exist.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.ONE 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
4 proc conents;
ERROR: Procedure CONENTS not found.
5 run;
I don't know what is going wrong. Thanks.
4 proc conents;
ERROR: Procedure CONENTS not found.
5 run;
typo error conents
Proc contents data=session1._all_ nods;
run;
run the above and verify
@khalillx wrote:
This is my first time ever doing this. Yet I was given the code for it and I'm not sure why it's not working. I'm trying to read in a permanent SAS data set and analyze the data. I put the data set into the folder I'm using, wrote down the exact code my professor gave us and I get the error message that the file does not exist. It's in my folder I assure you so I'm not sure what could be wrong. Yet, I've never done this before, I usually just import excel files into SAS so I don't understand what could be wrong. Here is my code, I hid my pathway:
libname session1 "C:\x";
data one;
set session1.hmda_subset_rev19;
proc conents;
run;
This is what's in the log:
libname session1 "C:\x";
NOTE: Libref SESSION1 was successfully assigned as follows:
Engine: V9
Physical Name: C:\x2 data one;
3 set session1.hmda_subset_rev19;
ERROR: File SESSION1.HMDA_SUBSET_REV19.DATA does not exist.NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.ONE 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
4 proc conents;
ERROR: Procedure CONENTS not found.
5 run;
I don't know what is going wrong. Thanks.
ERROR: File SESSION1.HMDA_SUBSET_REV19.DATA does not exist.
When SAS says a file does not exist, and the user says the file does exist, I believe SAS.
So, please show us a screen capture of this file in your operating system, so we can see it exists with that exact name, and so we can see that it is in folder "C:\x".
Hi,
try following code on your location and file.
libname session1 "C:\x";
data _null_;
IF exist("session1.hmda_subset_rev19")
then putlog "I exist.";
else putlog "I DON'T exits";
run;
all the best
Bart
Hi, I did that and SAS says it exists. What do I do not? Run the code again that I have in my question?
Have you been using any macro quoting functions like %bquote(), %str(), or %superq() earlier in the code? e.g to create macrovariable with dataset name?
Maybe try:
data one;
set %UNQUOTE(session1.hmda_subset_rev19);
proc contents;
run;
second thought, are the dataset name in the code and in the folder in the same case? i.e. both lower case letters?
Bart
So now, we have a conflict, on the one hand SAS is saying that the file does not exist, but on the other hand, SAS is saying that the file does exist.
Can you show us a screen capture of the contents of library SESSION1? (Usually, SAS will show you the contents of libraries on the left hand side of the SAS workspace, but the specifics depend on what interface you are using)
One more thing,
is there by any chance any space at the end of the dataset name?
Bart
@khalillx wrote:
I can assure you it’s in right folder.
Well, then, quite simply, I believe SAS.
I don’t know how to send a screen shot.
Take the screen capture, and then send it by clicking on the Photo icon when you are typing your reply here at SAS communities.
@khalillx wrote:
libname session1 "C:\econ385";
data one;
set session1.hmda_subset_rev19;
proc conents;
run;
Show us a screen capture of the SAS contents of that library. It's on the left hand side of whatever SAS interface you are using.
And put a RUN; statement to end your SAS data step, before starting the next PROC.
And spell CONTENTS properly.
Also, please show us the entire SAS log when you run this code, not just the error message.
To help us out, and preserve the appearance and formatting and spacing in the log, you need to copy the log as text (not a screen capture) and then click on the {i} icon when you reply here at SAS communities, and paste the log into the window that appears. Do not skip the step where you click on the {i} icon.
hmmm looks like folder is "C:\econ385" not "C:\x"
Bart
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.