Learning SAS? Welcome to the exclusive online community for all SAS learners.

Creating a permanent SAS dataset with libname

Reply
New Contributor
Posts: 4

Creating a permanent SAS dataset with libname


I would like to create a permanent sas dataset with libname. But I get the following error message

1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

57        

58         LIBNAME QDATA "folders/myfolders/sasuser.v94/mystuff/";

NOTE: Library QDATA does not exist.

58       !                                                        RUN;

59        

60         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

Here's the code I'm using;

LIBNAME TEST "folders/myfolders/sasuser.v94/mystuff/";RUN;

PROC IMPORT DATAFILE ="/folders/myfolders/sasuser.v94/mystuff/OBESITY AND CHD.xls"

     OUT=WORK.CHD

     DBMS=XLS

     REPLACE;

RUN;

PROC PRINT DATA=WORK.CHD; RUN;
DATA TEST.CHD; SET CHD;RUN;

Super User
Posts: 6,947

Re: Creating a permanent SAS dataset with libname

For one, I would not create a subdirectory in the sasuser.v94 directory, as this should be exclusively reserved for holding the SASUSER library.

And second, you need to create the phsical directory first to assign a libname to it.

So I suggest you first create the folder /folders/myfolders/mystuff and then do

libname QDATA '/folders/myfolders/mystuff';

Take note of the leading slash in filenames (see Unix filesystem - Wikipedia, the free encyclopedia)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
New Contributor
Posts: 4

Re: Creating a permanent SAS dataset with libname

thanks, that solved the issue

SAS Employee
Posts: 45

Re: Creating a permanent SAS dataset with libname

Always use '/' in the directory path, even in Windows operating environments. So your libname statement will end up becoming

LIBNAME TEST "/folders/myfolders/sasuser.v94/mystuff/";

The SAS University Edition Help Center has more information on how to create a SAS library here.

I hope this helps you out!

Ask a Question
Discussion stats
  • 3 replies
  • 388 views
  • 0 likes
  • 3 in conversation