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

how to put LIBNAME or FILENAME statement

Reply
New Contributor
Posts: 2

how to put LIBNAME or FILENAME statement

To access data for the course, I have to put certain path in my LIBNAME or FILENAME. Anyone knows where Libname or Filename appears and put my path/statement there?

Respected Advisor
Posts: 3,887

Re: how to put LIBNAME or FILENAME statement

Libname and Filename are global statements. You can use them anywhere in your SAS code outside of a run group (so not within a data step or a proc).

libname mylib 'c:\temp';

data mylib.mytable;

     set sashelp.class;

run;

New Contributor
Posts: 2

Re: how to put LIBNAME or FILENAME statement

Hi Patrick, Thanks a lottttt


Instruction goes like:

To access data for the course, use the following path in your LIBNAME or FILENAME statement: /courses/d0dba9e5ba27fe300/sta552


However, i have no idea where and how I actually put this link. Could you simplify your answer to a dummy like me?


Thanks a lot

Respected Advisor
Posts: 3,887

Re: how to put LIBNAME or FILENAME statement

In a code window issue the following code:

libname mylib '/courses/d0dba9e5ba27fe300/sta552';

Super User
Super User
Posts: 6,497

Re: how to put LIBNAME or FILENAME statement

Please read the SAS help pages.

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000214133.htm

The LIBNAME statement is used to associate a short alias (referred to as a libref or libname) with a physical data location (or path). 

Here is the first example from the manual page.  The path the instructor has given you would replace the text string SAS-library in the example below.  But what value to use for the libref (sales in the example below) is up to you. And what datasets are in the library (like quarter1 in the example below) will probably be different that in this example from the manual pages.

Example 1: Assigning and Using a Libref

This example assigns the libref SALES to an aggregate storage location that is specified in quotation marks as a physical filename. The DATA step creates SALES.QUARTER1 and stores it in that location. The PROC PRINT step references it by its two-level name, SALES.QUARTER1.

   libname sales 'SAS-library';

   data sales.quarter1;

      infile 'your-input-file'; 

      input salesrep $20. +6 jansales febsales

            marsales;

   run;

   proc print data=sales.quarter1;

   run;

Ask a Question
Discussion stats
  • 4 replies
  • 486 views
  • 3 likes
  • 3 in conversation