Lesson 3: Accessing Data in SAS

lesson-3-accessing-data-in-sas

How to Access Data in SAS

SAS tables are stored in SAS libraries. A SAS library is a collection of one or more SAS files that are recognized by SAS. In a Microsoft Windows environment, for example, a SAS library is typically a group of SAS files in the same folder or directory.

How to Access SAS Library

To access a SAS library, you assign it a name. The name is known as the libref, or library reference, and it refers to the physical location of the files. The libref is the nickname that you use to identify libraries in a SAS program.

SAS automatically assigns two libraries for you each time you start SAS.

  • Sashelp – a permanent library that contains sample data that you can use. This is a read-only library. You cannot save content to this library.
  • Work – a temporary library for files that do not need to be saved. Files in this library are deleted when you close SAS.

All SAS tables have a two-level name. The first name is the libref, which tells SAS which library contains the table. The second name is the name of the table. The two names are separated by a period.

For example, sashelp.class refers to the table named Class that is stored in the Sashelp library. If the table is stored in the temporary Work library, then you do not have to specify the two-level name. You can use only the name of the table, and SAS assumes that it is stored in the Work library.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s