chapter 1 overview of sas system basic concepts of sas system n.
Skip this Video
Loading SlideShow in 5 Seconds..
Chapter 1: Overview of SAS System Basic Concepts of SAS System PowerPoint Presentation
Download Presentation
Chapter 1: Overview of SAS System Basic Concepts of SAS System

Loading in 2 Seconds...

play fullscreen
1 / 33

Chapter 1: Overview of SAS System Basic Concepts of SAS System - PowerPoint PPT Presentation

  • Uploaded on

Chapter 1: Overview of SAS System Basic Concepts of SAS System. The SAS Programming Process. Define the Business Need. Create a SAS Program. Enter the SAS Program Code. Debug or Modify. Process the SAS Program Code. Review the Results. Reporting and Graphics. Data Access and

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Chapter 1: Overview of SAS System Basic Concepts of SAS System' - grady-reyes

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
the sas programming process
The SASProgrammingProcess

Define the Business Need

Create a SAS Program

Enter the SAS Program Code

Debug or Modify

Process the SAS Program Code

Review the Results

what is sas




Data Access






Base SAS






and Discovery



What Is SAS?

SAS is a collection of components that enable you to manage, manipulate, and examine your data.

basic functionality
Basic Functionality






types of files used with sas
Types of Files Used with SAS





SAS data set, Can be opened only by SAS system.

SAS program. It is created by users for solving problems. It can be created by the SAS Program Editor, or by any text editing software, then, copy and paste into SAS Program Editor, in order to be executed.

A raw data set in .dat format. In order to have a SAS program to read the text file, a statement linking the physical path storing the data in the SAS program is required. This is accomplished by ‘Infile’ statement in a SAS program.

how the sas program works
How the SAS program works

SAS Program Files

  • contain SAS program code
  • do not contain data values
  • can be saved and re-used.


sas programs
SAS Programs

A SAS program is a sequence of steps that the user submits for execution.


DATA steps are typically used to create SAS data sets.




SASData Set

SASData Set

PROC steps are typically used to process SAS data sets (that is, generate reports and graphs, edit data, and sort data).

components of a sas program
A SAS program is a sequence of steps.

There are only two kinds of steps:

DATA steps

PROC steps

Components of a SAS Program

A SAS Program

DATA step(s)

PROC step(s)

data step s

SAS Data Set

Data File



DATA Step(s)

Typically, DATA steps read data, such as raw data files, SAS data set, Excel data sheet, as well as to create SAS data sets.

Data type for input: .dat, .txt. , .sas7bdat, xls, etc

Data type from a Data step: .sas7bdat

sas data sets

Other Software Files

Data Entry

External File

Conversion Process

SAS Data Set

Descriptor Portion

Data Portion

SAS Data Sets
data step s1

SAS Data Set

Data File



DATA Step(s)

In addition, DATA steps can modify existing variables or create new variables as necessary.

proc step s

SAS Data Set




PROC Step(s)

PROC steps typically read SAS data sets to create reports, to analyze data.

proc step s1
PROC Step(s)

There are many different types of PROC steps.

PROC Step(s)


. . .



components of a step
Components of a Step

A SAS program is a sequence of steps:

  • DATA steps
  • PROC steps.

A step is a sequence of one or more statements.

components of a step1
Components of a Step

A statement usually starts with a keyword and always ends in a semicolon (;).

KEYWORD . . . ;

For example:

input name $ 1-8 age 11-12;

This INPUT statement can read the following data records:


Peterson 21

Morgan 17

Because NAME is a character variable, a $ appears between the variable name and column numbers.

components of a data step



Components of a DATA Step

A DATA step starts with a DATA statement and ends with a RUN statement.

data _______________ ;

_______________ ;

. . .

_______________ ;


components of a proc step



Components of a PROC Step

A PROC step starts with a PROC statement and ends with a RUN statement.

proc _______________ ;

_______________ ;

. . .

_______________ ;



Raw Data Files

  • are nonsoftware-specific files that contain records and fields
  • can be created by a variety of software products


  • can be read by a variety of software products
  • consist of no special attributes such as field headings, page breaks, or titles
  • are not reports.

SAS Data Sets

  • are files specific to SAS that contain variables and observations
  • can be created only by SAS
  • can be read only by SAS


  • consist of a descriptor portion and a data portion
how is a sas data set created

Other Software Files

Data Entry

External File

Conversion Process

SAS Data Set

Descriptor Portion

Data Portion

How is a SAS data set created?

Is accomplished in the DATA Step

sas data sets2
SAS Data Sets
  • The descriptor portion contains attribute information about the data in a SAS data set.

SAS data set name, Date/time created, # of variables, # of observations.

For each variable: Name, Type, Length, Position, Label.

  • The data portion contains the data values in the form of a rectangular table made up of observations and variables.





rules for a valid sas data set name and a valid variable of a sas data set
Rules for a Valid SAS Data Set Name and a Valid Variable of a SAS data set
  • Can be 1 to 32 characters long
  • Must begin with a letter (A-Z, either uppercase or lowercase) or an underscore (_)
  • Can continue with any combination of numbers, letters or underscores


Policy, pOLIcY , total_bud2010_ , _N_ are valid

Total-budget , 2010_budget , #num_stud are NOT valid

missing data in a sas data set
Missing data in a SAS data set
  • For a numeric variable, a missing data value is presented by a period (.)
  • For a character variable, a missing data value is presented by a Blank space.

Variable Length

  • A variable is stored in terms of # of bytes.
  • A character variable can be up to 32767 bytes long.
  • All numeric variables have a default variable length of 8, which are stored as floating-point numbers in 8 bytes of storage, unless is specified.

Variable format is the format of outputting the variable in the SAS data set.

  • Variable Informat is the specific format for inputting the variable into a standard SAS value.
  • Variable Label: describe the variable in a more descriptive way. It can be up to 256 characters.
sas libraries
SAS Libraries

A Library Name

Path to the physical HD location

Hard Drive

Every SAS file is stored in a SAS library.

SAS data set is one type of SAS file.

In some operating environment, a library is a physical collection of files.

In others, such as Windows and Unix environments, a library is a logical name consisting of a group of files that are stored in a physical location in a storage space.

Library can be Temporary or Permanent.

A SAS library must be prepared in order for a SAS program to reach the directory to either read or output a SAS data set.

SAS program only need to recognize the Library reference name.

reference a sas file in a sas library
Reference a SAS file in a SAS Library

A SAS library name has two-levels:


Libref is the the SAS Library name that is connected to a physical directory in a storage location in your computer.

fielname is a file stored in the directory referred to the Libref.

two types of sas library
Two types of SAS Library

Temporary SAS data set:

The LIBREF is always WORK, which is already available in the Libraries folder in Explore Panel of the SAS working environment.

Example: WORK.admit is a temporary SAS data set.

NOTE: one can ignor ‘WORK’ and specify the data set as admit, if it is stored in the WORK library as temporary library.

Permanent SAS data set:

The Libref is defined by the user.

For example: Mylib.admit refers to a SAS data set admit which is stored in the library named Mylib.

rules required for a valid sas library name
Rules required for a Valid SAS Library name
  • are limited to 8 characters
  • must start with a letter or underscore
  • can contain only letters, numbers, or underscores.


s575, _s575 , s575_ _s575_ are valid LIBREF

S-575 , sta575_online are not valid

an example of reading a sas data set
An Example of Reading a SAS Data Set

The Admit data set contains admission information for patients in a wellness clinic.


A SAS program does the following tasks:create a SAS library: Mylib,reads SAS data set Admit from the library clinic, select the patients with HIGH activity level, store the selected patients in the Mylib library with the SAS data set name: Admit_high,print the observations in the new data set

libnameMylib ‘C:\Math707\SASData’;

DATA Mylib.admit_high;

set clinic.admit;

if ActLevel=‘HIGH’;


PROC print data=Mylib.admit_high;