BookmarkSubscribeRSS Feed
ronaldo7
Calcite | Level 5

I am trying to import a dataset that is a .dat file using prespecified code (this is for the Youth Risk Behavior Survey). Please help:

 

CODE:

/****************************************************************************************/
/*  This SAS program creates a permanent SAS format library that is used to analyze to  */
/*  analyze the 2007 YRBS dataset.                                                      */
/*                                                                                      */
/*  Change the file location specification from "c:\yrbs2007" to the location where you */
/*  want the format library to be stored before you run this program.  Change the       */
/*  location specification in the "library" statement at the top of the program.        */
/*                                                                                      */
/*  Note: Run "YRBS_2007_SAS_Format_Program.sas" BEFORE you run                         */
/*  "YRBS_2007_SAS_Input_Program.sas" to create the 2007 YRBS dataset.                  */
/****************************************************************************************/



libname yrbs "home/uXXXXXXXX/sasuser.v94/yrbs2007.dat";
proc format library=yrbs;

 

ERROR MESSAGE:

WARNING: Library YRBS does not exist.
NOTE: Libref YRBS was successfully assigned as follows:
Engine: V9
Physical Name: /pbr/biconfig/940/Lev1/SASApp/home/uXXXXXXXX/sasuser.v94/yrbs2007.dat
85 proc format library=yrbs;
ERROR: Library YRBS does not exist.
 

 

3 REPLIES 3
Tom
Super User Tom
Super User

Since you use a RELATIVE path SAS is trying to find a directory named home under the current working directory.

 

Instead make sure to use an ABSOLUTE path.  Make sure that your path starts with the root node, / .

 

Also make sure the path points to a DIRECTORY and not to a FILE.

 

And do not put anything into the SASUSER directory.  SAS uses that directory to store your default option settings.

 

Try using your home directory (I assume the x'd out the actual account name).

libname yrbs "/home/uXXXXXXXX/";

Or make a subdirectory and use that.

libname yrbs "/home/uXXXXXXXX/yrbs/";

 

 

Kurt_Bremser
Super User

A Base library (where no specific engine is used) has to point to a directory, not a file.

Libraries that point to a file are used with specific engines, like

libname myex xlsx "/path/file.xlsx";

I guess you have a SAS program supplied by the website, and misunderstood how you need to adapt it to your environment (SAS On Demand?).

 

In your home directory, create a directory called yrbs2007. Then change the libname:

libname yrbs "/home/uXXXXXXXX/yrbs2007";

Note the leading slash, making this an absolute path instead of a relative one. You can abbreviate the path to your home directory by using the tilde character, or the HOME environment variable:

libname yrbs "$HOME/yrbs2007";
libname yrbs "~/yrbs2007";
ChrisNZ
Tourmaline | Level 20

The libname statement pointing to your home directory can be written as:

libname YRBS '~';

The data set YRBS2007 is file yrbs2007.sasb7dat can then be referenced like this:

 

proc print data=YRBS.YRBS2007; run;  

 

 

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 399 views
  • 0 likes
  • 4 in conversation