You are on page 1of 25

Lesson 4 Working with SAS Libraries and SAS Datasets

Objectives
In this lesson, you learn to do the following, assign a libref to a SAS library by using the LIBNAME statement explore the contents of SAS libraries by using the CONTENTS procedure or the Explorer window Identify and describe the structure and components of a SAS dataset

identify the two main types of values(character and numeric) and


missing values view the description and data portion of SAS datasets

sort the observation in a SAS dataset by using the SORT procedure


assign a library reference name to a relational database by using the SAS/ACCESS LIBNAME statement.

Understanding SAS Libraries


What is a SAS Library ?

Understanding SAS Libraries


How SAS Libraries are defined

Temporary

Permanent

Understanding SAS Libraries


Two Level Data Set Names

Understanding SAS Libraries


Two Level Data Set Names

Defining SAS Libraries


The LIBNAME Statement

Defining SAS Libraries


Specifying a Libref

1. 1-8 Characters 2. Letter or underscore 3. Letter, numbers or underscores

Defining SAS Libraries


Specifying a Physical Name

Viewing the contents of SAS Libraries


Using PROC CONTENTS to view the Contents of a Library

Understanding the Structure of SAS Data Sets


The Data and Descriptor Portions

Viewing the Descriptor Portion of SAS Data Sets


Using the PROC CONTENTS to View the Descriptor Portion

Viewing the Descriptor Portion of SAS Data Sets


Attributes of SAS variables

1 byte = 1 character Numeric Variable default length = 8 bytes (16 or 17 significant digits)

Viewing the Data Portion of SAS Data Sets


PROC PRINT

Viewing the Data Portion of SAS Data Sets


Missing Values

Viewing the Data Portion of SAS Data Sets


The VAR Statement

Viewing the Data Portion of SAS Data Sets


The NOBS Option

Sorting Observations in SAS Data Sets

Sorting Observations in SAS Data Sets


PROC SORT

Sorting Observations in SAS Data Sets


Sorting by Multiple Variables using PROC SORT

Defining SAS Libraries for Relational Databases


SAS/ACCESS

Defining SAS Libraries for Relational Databases


SAS/ACCESS

Defining SAS Libraries for Relational Databases


The SAS/ACCESS LIBNAME Statement

Defining SAS Libraries for Relational Databases


Referencing Database Tables in SAS Programs

Defining SAS Libraries for Relational Databases


Disassociating a Libref

You might also like