Accessing Other Libraries
So far, we have only worked with data sets in the WORK library.
You can access data sets from other libraries using the LIBNAME statement.
Example
Data Cars;
Set SASHELP.Cars;
Run;
The SASHELP reference above is called the library reference. It is needed when referring to a data set that is not in the WORK library.
In this example, the CARS data set is created in the WORK library based on the same data set from the SASHELP library.
You will find the CARS data set from the WORK library a carbon copy of the one from SASHELP.
Exercise
Locate the HOLIDAY data set from SASHELP.
Create a subset of the HOLIDAY data set that contains only the holidays that fall in January.
Name the new data set as JanHol and have it created in the WORK library.
How many observations are there in the subset?
Need some help?
HINT:
The variable that contains the holiday month information is called MONTH. It is the 6th variable in the HOLIDAY data set.
SOLUTION:
Data JanHol;
Set SASHELP.Holiday;
If month = 1;
Run;
There are 3 observations in this subset.
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. |