Help using Base SAS procedures

Error message: Libname <dataset> is not assigned

Reply
Occasional Contributor
Posts: 5

Error message: Libname <dataset> is not assigned

[ Edited ]

while working encountered error message ERROR: Libname <dataset>is not assigned.please help to understand and remedy 

 

7 proc print data=in2.prac;
ERROR: Libname IN2 is not assigned.
8 run;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds

 

Super User
Posts: 10,538

Re: Error message


maddyjoshi29 wrote:

while working encountered error message ERROR: Libname <dataset>is not assigned.please help to understand and remedy 

 

7 proc print data=in2.prac; < this line says the data set to print named PRAC is in the library named IN2.
ERROR: Libname IN2 is not assigned.
8 run;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds

 


If the library has not been assigned for the current session then SAS cannot find the data. A libname statement similar to:

LIBNAME IN2 "C:\path\foldername";

is one way to provide a library. If you use the menu (such as Tools>New Library) to create a library you may need to indicate "make it permanent" by checking a box to make the system automatically assign the the library the next time SAS starts. The exact approach varies between Base SAS, Enterprise Guide, SAS Studio and University Edition (varies a LOT for UE).

Occasional Contributor
Posts: 5

Re: Error message

I am using SAS version 9.0. I cant see option for new library in tools.... what I am trying to do is , though I have been doing this from quite some time and successfully done it before but now getting error.

I go to file > import data( saved in 97,2003 format in excel in drive and save in as folder in one of my library... I have attached the screenshot of steps for your reference.
Super User
Posts: 10,538

Re: Error message

Screen shots didn't attach apparently.

 

Which LIBRARY did you tell the import to go to? The default would likely have been WORK. If you didn't assign a library you might look in the SAS Explorer window for a library with an odd name and look there for the data file. If so, change the proc print to use that library name instead of IN2.

Occasional Contributor
Posts: 5

Re: Error message

I have already created a library (by the name of Recorded) and saved my imported excel file by the name of IN2.
And when I write -
Proc Print data=In2.recorded;
run;
it doesn't run and gives that error in log.
Super User
Posts: 10,538

Re: Error message


maddyjoshi29 wrote:
I have already created a library (by the name of Recorded) and saved my imported excel file by the name of IN2.
And when I write -
Proc Print data=In2.recorded;
run;
it doesn't run and gives that error in log.

The reference is always library.dataset, not dataset.library.

Us

proc print data=recorded.in2;

Occasional Contributor
Posts: 5

Re: Error message

oh my god... I didnt even notice this mistake.. thank you so much ballardw Smiley HappySmiley Happy.. appreciate your effort.. thanks a
ton
Super User
Posts: 17,912

Re: Error message: Libname <dataset> is not assigned

I doubt you're using SAS 9.0, can you confirm with the following code, check your log for the output:

 

%put &sysver;

Navigate to your library/folders window on the left hand side. Do you see a library called IN2? If not, you can create it using the code previously suggested. 

 

If this is a library that you expect to be pre-assigned, ie assigned when you start up, it could be either a temporary network glitch when you started SAS didn't allow for the library to be assigned or something changed.

 

 

Occasional Contributor
Posts: 5

Re: Error message: Libname <dataset> is not assigned

hello Reeza,

I will check that though but I'm sure using ver-9.0
I had been able to create library and run the code previously... nevertheless will check again and keep posted.
SAS Super FREQ
Posts: 8,744

Re: Error message: Libname <dataset> is not assigned

Hi:

  The LIBRARY is a nickname for a physical path location on your operating system or server. For example, these all define the ORION library:

Windows: libname orion 'c:\temp\classes\pg1';
Unix: libname orion '/unx/classes/pg1';
Mainframe: libname orion 'SASCZZ.DATA.CLASSES.PG1' DISP=SHR;
SAS on Demand server: libname orion '/home/cynther0/pg1';
SAS University Edition: libname orion '/folders/myfolders/ecprg193';

   Once you have the library defined, then you can run PROC CONTENTS to see the names of the datasets stored in the library:

proc contents data=orion._all_;
  title 'what are the datasets';
run;

  Then, you refer to the datasets by their 2 level name. So, let's take Windows as an example. If I have

Physical file name, as stored on disk: c:\temp\classes\pg1\customers.sas7bdat
LIBNAME statement: libname orion 'c:\temp\classes\pg1';
 
Then to print the rows, I would use this code:
proc print data=orion.customers;
  title 'Orion.Customers';
run;

 

As you can see, ORION (the name of the library) is the first part of the 2-level name and CUSTOMERS (the file name of the physical file) is the second part of the 2-level name.

 

  This is how the LIBNAME works, no matter what version of SAS you are using.

 

cynthia

Ask a Question
Discussion stats
  • 9 replies
  • 398 views
  • 0 likes
  • 4 in conversation