BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
julianna1644
Calcite | Level 5

Hi all, 

I'm new to SAS and I keep getting the error 'Library does not exist'. I am using SAS 9.4 on Windows 10. 

 

My code looks like: 

libname libsas 'C:\libsas\finaldata';
data libsas.finaldata;
run;

 

When I run it I get: 

ERROR: Library LIBSAS does not exist 

 

I've been hunting on this board to see if I can try others solutions. What I've tried: 

- Not copy and pasting. 

-libname libsas 'C:\Users\MYUSERNAME\libsas\finaldata';
data libsas.finaldata;
run; 

(This gives me the same error)

- putting / instead of \ (This was likely a dumb attempt but I'm new to this haha)

- Saving it to my usb and trying to use 'D:' (I got the same Library does not exist error)

- Tried a new computer. Same error. 

 

If anyone can give me guidance or other suggestions that would be greatly appreciated. 

Thank you! 

1 ACCEPTED SOLUTION

Accepted Solutions
SASJedi
SAS Super FREQ

Here are the most common reasons why SAS can't find the file or folder you are referencing:

1. A typo in the code. For example, I am running PC SAS. There are SAS data sets in the c:\testfile folder that I need. I submit this code:

LIBNAME T "C:\testfiles";

and the LOG says:

NOTE: Library T does not exist.

 

2. SAS doesn't have access to the file location you have specified. This usually happens when you're using client software, like Enterprise Guide or SAS Studio, to write and submit your SAS code, but SAS isn't installed on your computer - it's running on a server somewhere else. It gets tricky because it's essential to differentiate between what the client can see and what the SAS server can see because now they are installed on two different machines. So let's step through this, starting with SAS installed on your computer.
Windows Explorer (gear image) can see the files on the local hard drive. Because SAS is installed on the PC, if you expand Folders under the Local server in Enterprise Guide, you can see the same files there: 

SASJedi_0-1657121669969.png

 

If I have a network drive mapped, both Windows Explorer and the Enterprise Guide Server can see those files, too:

SASJedi_1-1657122016143.png


Now, when SAS is installed on a separate server (including SAS University Edition, where SAS is running on a virtual server), the SAS server can no longer "see" files on the PC hard drive. Windows and SAS no longer share the same "view". If you browse the SAS Server files in Enterprise Guide, you can see the view is different:

SASJedi_4-1657123254454.png

 

If the PC and SAS server both have access to the same network location, you can move files there in Windows and "see" them in SAS, but the PATH to those in Windows will be different than the path on the SAS server:

 

SASJedi_3-1657122825015.png

So, when SAS was installed on the PC, this LIBNAME would have worked:

libname t "s:\workshop";

And with SAS on the server, this LIBNAME would see the same data:

libname t "/mnt/share/workshop";

If you can't locate your network files in Enterprise Guide (or SAS Studio) by browsing in the Server -> Files folders, it might still be possible to access them from SAS, but you'll need to ask your SAS administrator how to specify the proper path.  

May the SAS be with you!

Mark

 

Check out my Jedi SAS Tricks for SAS Users

View solution in original post

20 REPLIES 20
ScottBass
Rhodochrosite | Level 12

Base SAS, SAS EG, or SAS/Studio?

 

Does C:\libsas\finaldata actually exist?  

 

Edit:  run this code in your SAS session and post the results from the SAS log:

 

filename dir pipe "dir /b c:\";
data _null_;
   infile dir;
   input;
   put _infile_;
run;

Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
julianna1644
Calcite | Level 5

How do I find out which SAS it is beyond 9.4? It's on my university's computers, if this information helps in any way. 

 

I ran the code as you sent me as: 

libname libsas 'C:\libsas\finaldata';
data libsas.findata;

filename dir pipe "dir /b c:\libsas\finaldata";
data _null_;
infile dir;
input;
put _infile_;
run;

 

and received: 

10 libname libsas 'C:\libsas\finaldata';
NOTE: Library LIBSAS does not exist.
11 data libsas.findata;
12
13 filename dir pipe "dir /b c:\libsas\finaldata";

ERROR: Library LIBSAS does not exist.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

 

14 data _null_;
15 infile dir;
16 input;
17 put _infile_;
18 run;

NOTE: The infile DIR is:
Unnamed Pipe Access Device,
PROCESS=dir /b c:\libsas\finaldata,RECFM=V,
LRECL=32767

Stderr output:
File Not Found
NOTE: 0 records were read from the infile DIR.
NOTE: DATA statement used (Total process time):
real time 0.06 seconds
cpu time 0.00 seconds

 

 

Please let me know if I inputted anything incorrectly. 

 

 

 

mkeintz
PROC Star

The log messages you post

 

PROCESS=dir /b c:\libsas\finaldata,RECFM=V,
LRECL=32767
Stderr output:
File Not Found
NOTE: 0 records were read from the infile DIR.

tells you that the directory c:\libsas\finaldata does not exist.  So you would need to create that directory first, or use a directory you know exists.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
ScottBass
Rhodochrosite | Level 12

You didn't run the code I sent you.


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
shashank1691
Calcite | Level 5

Hello,

I am getting same error with the libname and i am unable to import any data.

 

I tried running the code you mentioned and here are the log results

 

2 filename dir pipe "dir /b c:\";
3 data _null_;
4 infile dir;
5 input;
6 put _infile_;
7 run;

NOTE: The infile DIR is:
Unnamed Pipe Access Device,
PROCESS=dir /b c:\,RECFM=V,LRECL=32767

dc
FFOutput
HPHWDiag_log.txt
inetpub
Intel
pcfservice.log
PerfLogs
Program Files
Program Files (x86)
SHANKY
SWSetup
Users
Windows
NOTE: 13 records were read from the infile DIR.
The minimum record length was 2.
The maximum record length was 19.
NOTE: DATA statement used (Total process time):
real time 0.37 seconds
cpu time 0.01 seconds

 

Reeza
Super User
SAS University Edition? If so, you need to use myfolders folder you set up during installation as your data location.
julianna1644
Calcite | Level 5

It is for a university class, and I'm using it on a school computer on campus. Does that automatically make it University Edition? I didn't download it myself. On previous assignments I haven't had to do the myfolder step, but I can see if that's something that helps. Thanks! 

ScottBass
Rhodochrosite | Level 12

I don't use University Edition, so this may or may not help.  Or I should just step back and let @Reeza work her magic.

 

But try submitting:

 

libname myfolders list;

* or ;

libname _all_ list;

Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
julianna1644
Calcite | Level 5

I'm not sure if I'm using the University Edition. I'm using the version that my university has on all their computers, I'm sure how to determine what version it is. I'm contemplating downloading the free UE version to try this from a new angel though. 

 

I tried both of those and they're both showing that LIBSAS does not exist. Thank you for your suggestions though. 

Reeza
Super User

@julianna1644 wrote:

I'm not sure if I'm using the University Edition. I'm using the version that my university has on all their computers, I'm sure how to determine what version it is. I'm contemplating downloading the free UE version to try this from a new angel though. 

 

I tried both of those and they're both showing that LIBSAS does not exist. Thank you for your suggestions though. 


Ok, you're likely not using SAS UE then and you should see your labs instructions about how to access the files. Usually they automatically connect to either your local area or somewhere else. 

 

If you run the following and post the log we can likely tell you what you're running. 

SAS Base would look like a standard IDE with just a window for code and the log. 

SAS Studio would be accessed by your browser only

SAS EG would be linked to something that's sort of in between with process flows. The icon looks like a triangle. It will say EG on the launch usually though. 

 

You can find out your version info from running the following:

 

proc product_status;run;

As to where to save your files and access it, I suspect your lab or instructor will have those instructions somewhere. No one bothers to set up SAS on a full lab without some base instructions in a University. 

 


@julianna1644 wrote:

I'm not sure if I'm using the University Edition. I'm using the version that my university has on all their computers, I'm sure how to determine what version it is. I'm contemplating downloading the free UE version to try this from a new angel though. 

 

I tried both of those and they're both showing that LIBSAS does not exist. Thank you for your suggestions though. 


 

shashank1691
Calcite | Level 5

Hello,

I tried the code you mentioned and this is the log result i got.

Could you please guide?

 

9 libname _all_ list;
NOTE: Libref= SHASHANK
Scope= DMS Process
Engine= V9
Physical Name= C:\Users\Shashank\Desktop\SAS TEST
Filename= C:\Users\Shashank\Desktop\SAS TEST
NOTE: Libref= TMP1
Scope= DMS Process
Engine= V9
Physical Name= C:\Users\Shashank\Desktop\SAS\Demo1
Filename= C:\Users\Shashank\Desktop\SAS\Demo1
NOTE: Libref= SHWETA
Scope= DMS Process
Engine= XPORT
Physical Name= C:\Users\Shashank\Desktop\SYMPATHY EMPATHY\SAS DATA\demo1
NOTE: Libref= SASHELP
Scope= Kernel
Levels= 12
-Level 1-
Engine= V9
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\nls\en\SASCFG
Filename= C:\Program Files\SASHome\SASFoundation\9.4\nls\en\SASCFG
-Level 2-
Engine= V9
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\core\sashelp
Filename= C:\Program Files\SASHome\SASFoundation\9.4\core\sashelp
-Level 3-
Engine= V9
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\aacomp\sashelp
Filename= C:\Program Files\SASHome\SASFoundation\9.4\aacomp\sashelp
-Level 4-
Engine= V9
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\cmp\sashelp
Filename= C:\Program Files\SASHome\SASFoundation\9.4\cmp\sashelp
-Level 5-
Engine= V9
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\dmine\sashelp
Filename= C:\Program Files\SASHome\SASFoundation\9.4\dmine\sashelp
-Level 6-
Engine= V9
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\ets\sashelp
Filename= C:\Program Files\SASHome\SASFoundation\9.4\ets\sashelp
-Level 7-
Engine= V9
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\graph\sashelp
Filename= C:\Program Files\SASHome\SASFoundation\9.4\graph\sashelp
-Level 8-
Engine= V9
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\iml\sashelp
Filename= C:\Program Files\SASHome\SASFoundation\9.4\iml\sashelp
-Level 9-
Engine= V9
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\inttech\sashelp
Filename= C:\Program Files\SASHome\SASFoundation\9.4\inttech\sashelp
-Level 10-
Engine= V9
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\or\sashelp
Filename= C:\Program Files\SASHome\SASFoundation\9.4\or\sashelp
-Level 11-
Engine= V9
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\stat\sashelp
Filename= C:\Program Files\SASHome\SASFoundation\9.4\stat\sashelp
-Level 12-
Engine= V9
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\tmine\sashelp
Filename= C:\Program Files\SASHome\SASFoundation\9.4\tmine\sashelp
NOTE: Libref= MAPS
Scope= Kernel
Engine= V9
Access= READONLY
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\maps
Filename= C:\Program Files\SASHome\SASFoundation\9.4\maps
NOTE: Libref= MAPSSAS
Scope= Kernel
Engine= V9
Access= READONLY
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\maps
Filename= C:\Program Files\SASHome\SASFoundation\9.4\maps
NOTE: Libref= MAPSGFK
Scope= Kernel
Engine= V9
Access= READONLY
Physical Name= C:\Program Files\SASHome\SASFoundation\9.4\mapsgfk
Filename= C:\Program Files\SASHome\SASFoundation\9.4\mapsgfk
NOTE: Libref= SASUSER
Scope= Kernel
Engine= V9
Physical Name= C:\Users\Shashank\Documents\My SAS Files\9.4
Filename= C:\Users\Shashank\Documents\My SAS Files\9.4
NOTE: Libref= WORK
Scope= Kernel
Engine= V9
Access= TEMP
Physical Name= C:\Users\Shashank\AppData\Local\Temp\SAS Temporary
Files\_TD9176_LAPTOP-0J3S2GHG_
Filename= C:\Users\Shashank\AppData\Local\Temp\SAS Temporary
Files\_TD9176_LAPTOP-0J3S2GHG_

shashank1691
Calcite | Level 5

Hello,

When I try to import xlsx file, after selecting the file and clicking okay,

I get a prompt "Connection Failed: Please check the log window".

 

The result I get in Log window is below:

 

ERROR: Connect: Class not registered
ERROR: Error in the LIBNAME statement.

Kurt_Bremser
Super User

I'm confused. Are we now talking about a library that fails to assign, or a PROC IMPORT of an xls file?

 

Please post the complete log of what fails, code and all messages, and post it into a window opened with this button:

Bildschirmfoto 2020-04-07 um 08.32.59.jpg

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 20 replies
  • 37232 views
  • 2 likes
  • 8 in conversation