Data Set [10-14]

Accessing your own data sets – Part II

In the last section, you have uploaded the Car data set to the Files (Home) folder on the SAS server.

Picture

The Files (Home) folder is the home directory of the SAS server.

Inside this folder, you can have multiple sub-folders.

DS1 is a sub-folder that we created in the exercise in the previous section.​

Picture

Now, let's look at how you can use SAS code to access the Car data set in the Files (Home) folder. 

We will first have to get the corresponding directory path, where the data set is located.​

Example

​First, right click on Files (Home).

Then, click Properties.

Picture

You will find the location of this folder on the server.

Picture

The directory path of the Files (Home) folder is:

'/home/kisumsam'

Please note that your path will be different.

Your path will include your unique user name.

​It will be in the form of:

'/home/your_user_name'


Creating a Library

Now we know the directory path to where the Car data set is located.

We must now create a library. 

This can be done using a Libname statement. 

Example

LIBNAME Proj1 "/home/kisumsam";

Picture

The LIBNAME statement consists of three parts:

1. LIBNAME
This tells SAS to create a new library.

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

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

In our example, the library is associated with ​"/home/kisumsam".


Now, run the LIBNAME statement with your own unique directory path:

LIBNAME Proj1 "/home/your_user_name";

A new library called PROJ1 is created:

Picture

The Car data set can be found in the PROJ1 library:

Picture

Double click the Car data set.

The data set will open up:

Picture

Exercise

In our last exercise, we have saved the INCOME data set in the DS1 shared folder. 

Write a SAS program to copy the INCOME data set into the WORK library.

Need some help?

Get Hint

Get Solution