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.
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.
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.
You will find the location of this folder on the server.
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";
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:
The Car data set can be found in the PROJ1 library:
Double click the Car data set.
The data set will open up:
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?
HINT:
In order to access the INCOME data set, you must create a library associated with the DS1 folder that contains the INCOME data set.
SOLUTION:
Libname PROJ2 ‘/home/your_unique_username/DS1’;
Data Income;
Set PROJ2.Income;
Run;
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |