Introduction to SAS [14-19]


Accessing your own data sets – not applicable to SAS OnDemand for Academics

In this section, you will learn how to access external data sets in SAS.

⚠️ Important

This topic is applicable for those who are NOT using SAS OnDemand for Academics.

If you are using SAS OnDemand for Academics, please skip this topic and proceed to the next topic.

You can access an external SAS data set by creating a new library.

Let's look at an example.

First, download the CAR data set and save it on your local computer.

In this example, the file has been saved in a folder in the C drive. The exact location path is below:


You can save your file anywhere on your PC, as long as the location can be accessed by SAS.

Now, go to your SAS software and run a LIBNAME statement.

LIBNAME Proj1 "C:\Users\kisum\Documents\sas_practice";

The LIBNAME statement is used to create a library that is connected to an external location.

It consists of three parts:

This tells SAS to create a new library.

2. Library Name
The second part of the LIBNAME statement is the library name. In this example, it is PROJ1

3. Directory Path
Lastly, you will have to specify the path that is connected to the library. 

In this example, the library is connected to "C:\Users\kisum\Documents\sas_practice".

Now, run the LIBNAME statement with the path where your CAR data set is located:

LIBNAME Proj1 "Your-directory-path";

You should see a new library created.

It is called PROJ1, and it has the CAR data set in it.

Double click it. You should see the data inside the data set:

You have done well! ?️

Save your progress by creating a free SASCrunch account now.


Download the INCOME data set and save it on your local computer.

Create a library that allows you to store and read the INCOME data set.

How many observations are there in the INCOME data set?

Get Hint

Get Solution