Introduction to SAS [15-19]

h

Accessing your own data sets – SAS OnDemand for Academics

In this topic, we will learn how to access external SAS data sets using SAS OnDemand for Academics.

⚠️ Important

This topic is applicable only for users of SAS OnDemand for Academics.

If you are using any other version of SAS, please skip this topic and proceed to the next topic.

Accessing external SAS data sets using SODA (SAS OnDemand for Academics) is a little tricky.

If you are using any other version of SAS, you can generally access your files directly on your computer.

However, SAS OnDemand for Academics runs on a SAS server. It is a web application and it cannot directly access the files on your local PC (or your server).

In order to access your own files using SAS OnDemand for Academics, you need to first upload them to the SAS server.

You will learn how to do that in this topic.

Let's look at an example.

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

Now, go to SAS Studio. Under Server Files and Folders, right click on Files (Home) and click Upload Files:

A window will pop up. Click "Choose Files" and upload the CAR data set that you downloaded earlier.

Picture

Done! The CAR data set is uploaded to your home directory!

Picture

Now, having the files on the SAS server does not mean you can access it.

It merely means the files are uploaded on a server somewhere.

You still need to connect SAS Studio with the server in order to see the data on SAS Studio.


File location

Now, let's look at where the CAR data set is located.

Right click on the CAR data file and click Properties:

Here, you will find exactly where your CAR data set is located.

In this example, the CAR data set is located in "/home/kisumsam".

This is where the CAR data set is located.

However, the location of your file will be different.

Your path will include your unique user name. ​It will be in the form of:

'/home/your_user_name'

Example
'/home/david123'
'/home/dwane789'

Note: each SODA user is allocated 2GB of disk space on the SAS server.

The folder "/home/your_user_name" is your home directory on the SAS server.

You can upload files and also create sub-folders in the home directory.

Now, in order for us to access the files on the SAS server, we need to create a SAS library.

Go to your SAS Studio and run a LIBNAME statement.

LIBNAME Proj1 "/home/kisumsam";
Picture

The LIBNAME statement is used to create a library that is connected to the SAS server.

It 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 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 ​"/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:

Picture

💪 Sign up for a free SASCrunch account now and keep track of your learning progress!


Exercise

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

Create a sub-folder in your home directory called DS1.

Upload the INCOME data set to the DS1 folder and access the INCOME data set through this library.

How many observations are there in the INCOME data set?

Need some help?

Get Hint

Get Solution