Sentry Page Protection
Accessing Library
SAS Base Exam
SAS Base Exam
Library
Accessing data sets from different libraries is a common SAS programming task.
In this session, you will learn how to:
In this session, you will learn how to:
- Create a temporary data set
- Create a permanent library and data set
- Read the data from one data set and write it onto another
Create a Temporary Data Set
Code
Data DS1;
XYZ = 1;
Run;
Code
Data DS1;
XYZ = 1;
Run;
This creates a temporary data set in the WORK library.
Create a Permanent Library and Permanent Data Set
Code
Libname NewLib '/folders/myfolders';
Data NewLib.DS2;
XYZ = 2;
Run;
Code
Libname NewLib '/folders/myfolders';
Data NewLib.DS2;
XYZ = 2;
Run;
The libname statement creates a new library called NewLib.
Libname NewLib '/folders/myfolders';
A library reference (libref) of NewLib is added to the DS2 data set (i.e. NewLib.DS2).
Data NewLib.DS2;
XYZ = 2;
Run;
As a result, the data step creates a permanent data set in the NewLib library.
Read data from a data set and write it onto another
Code
Libname NewLib '/folders/myfolders';
Data NewLib.DS3;
Set Work.DS1;
Run;
Code
Libname NewLib '/folders/myfolders';
Data NewLib.DS3;
Set Work.DS1;
Run;
Exercise
Compute the average market share percentage by Internet Explorer (IE) over the 13-month period.
Compute the average market share percentage by Internet Explorer (IE) over the 13-month period.
Need some help?
Fill out my online form.