Sei sulla pagina 1di 6

Chapter 1 & 2: Introduction

SAS Full form- Statistical analysis system

It is developed at North Carolina State university

Originally developed for Agricultural Research Purposes, developed in between 1960’s and 1970’s
SAS = Data warehousing Tool + Statistical Package
The main functions of Data Warehousing Tool are ETL – Extraction, transforming and
Loading and Reporting
The main function of Statistical Package is Data Analysis
So, SAS can do all Data management, Data cleaning, Data manipulation, Data Analysis and
Reporting work.
SAS features,
It can process unlimited rows and columns,
Built in statistical functions for performing analysis,
Several numeric and characters functions for data manipulations,
Interact with multiple database and operating systems.
SAS Based Industries,
Health care and pharmacy,
Financial services,
Retail and Telecom,
Marketics, Analytics etc.,
SAS is used for,

Data management
Business intelligence
Predictive Analysis
Descriptive and Prescriptive Analysis etc.,
SAS has solution for,
Data Governance
Data Quality
Big Data Analytics
Data Mining
Fraud management
Health science etc.,
We can safely assume SAS has a solution for every business domain.
SAS enables you to,

Enter, retrieve and manage your data easily


Create slick reports and pretty pictures
Analyze your data statistically and mathematically
Plan, forecast and make decisions concerning your business
Manage your projects and perform research on how you conduct your operations
Improve the quality of your processes, as well as
Develop entirely new software applications.

SAS programming
SAS Windows

Editor Window – We can write, Edit and submit our SAS programs

Log Window – Contains all the notes like Commands/program lines/statements


submitted, execution details and displays errors and warnings if any
Contains all the notes in 4 different colors – Black, Blue, Green, Red
Black - Commands/program lines/statements
Blue - Execution details
Green - warnings
Red - Errors
Output Window – Results are printed in Output window

Explorer Window – Storage place for all SAS Files. Contains folders like libraries,
favorite folders, computer, file shortcuts etc.,

Results Window – Used to navigate the output window, serves much like a table of
contents for Output Window.
SAS Program steps:

Data step and Proc step

Data step Proc Step

(1) Starts with keyword ‘Data’ (1) Starts with key word ‘Proc’
(2) Used to create and modify data (2) Perform specific analysis
(3) Create a SAS data set (3) Generate results or reports

workflow in SAS

Data Step ---> Create Data/Modifying Data –---> Proc Step -----> Data Analysis/ Reporting
SAS Files,

There are two types of SAS files

(1) Dataset – SAS data is stored


(2) Catalog – Stores all macro variables, informats and formats information

SAS Dataset

Data is stored in tables which are called as SAS datasets


Tables Datasets
Rows Observations
Columns Variables

SAS Libraries

SAS Data files/sets are stored in SAS library

Types of SAS libraries:

There are two types of SAS libraries,

(1) Permanent library,

SASUser and SASHelp are inbuilt permanent libraries of SAS. We can create a new SAS
library by using SAS utilities or by writing the codes in the editor window. These libraries are
named as permanent because if we create a program in SAS and save it in these permanent
libraries then these will be available as long as we want them.

(2) Temporary library,

Work is the inbuilt temporary library of SAS. All the programs that we create are stored in
this work library if we do not assign any other library to them. You can check this work library in
the Explore Window. If you create a SAS program and have not assign any permanent library to it
then if you end the session after that again you start the software then this program will not be in
the work library. Because it will only be there in Work library as long as the session goes ones.

Creating the libraries:

We can create libraries by using either ‘libname’ statement or SAS utilities

The format of the LIBNAME statement is:

Syntax: LIBNAME libref 'File path name here';

LIBNAME is the SAS keyword that tells it to create a library.


Libref is what you name the library.
The text in quotes is path name to assign the library to
Example: LIBNAME practice 'C:\Users\Research\Thesis';

Explanation: LIBNAME statement creates the library named practice and


assigns it to a folder in the directory ‘C:\Users\Research\Thesis.’

Rules For creating SAS library names:

 Must be 8 characters or less


 Must begin with a letter or underscore
 Must contain only letters, numbers or underscores, no special characters including blank
spaces

Naming:

Two level naming

To store SAS datasets in any created temporary or permanent library, we have to give
library name before the dataset name. Library name and dataset name should be separated by ‘.’
This is Two level naming

One level naming

You can omit the libname, and give only dataset name, then it is one-level naming

SAS program:

Data Emp_data;
Input ID Name $ Dept $;
Cards;
101 Rick IT
102 Dan OPS
103 Tusar IT
104 Pranav OPS
105 Rasmi FIN
Run;

Proc print Data=Emp_data;


Run;

SAS reads the data line by line, observation by observation

Rules for creating SAS dataset names and Variable names

We can also simply call as Rules for creating SAS names

• Names must be 32 characters long or less


• Can be uppercase, lowercase or mixed-case i.e., not case-sensitive
• Must start with a letter or underscore. Subsequent characters can be letters,
underscores, or numeric digits
• No special characters like $, #, %, &, * etc., including blank spaces
Example Valid names: _name, my_name, zip5, U_and_mE
Invalid names: -name, my-name, 5 zips, per%, u&me, my@w

SAS programs Layout:

• Every SAS statement should end with semicolon;

• SAS statements can be in lowercase, uppercase or mixed case

• We can write multiple SAS statements in single line

• Also, they can start from any position in a line


Comments:
We can insert comment lines in our SAS programs
There are two ways to do this

(1) start with * put text and then end with;


(2) Start and end with /* and put text in middle... short cut to do this is ctrl+/

SAS Data values/ Variable values/ Data types:

Two data types are there,

(1) Character -Character values default length is 8 bytes and can be


increased up to 32,767 bytes by using LENGTH statement
1byte = 1 character.
contains any value like letters, numbers, special characters and blanks.
$ followed by variable name indicates it as a character variable
(2) Numeric – Get stores as normal numeric value till 12 digits and after that get stored in
electronic format. Contains only numbers

Standard numeric data values

Recall that standard numeric data values can contain only:


• Numbers
• decimal points
• numbers using scientific (E) notation
• negative (minus) and positive (plus) signs

Examples of standard numeric values include:


26, 3.9, -13, +3.14, 314E-2, and 2.193E3.
Nonstandard numeric data values

On the other hand, nonstandard numeric data values include:


• values that contain special characters, such as dollar signs ($),
commas (,)
• date and time values
• data in fraction, integer binary, real binary, and hexadecimal forms

Examples of nonstandard numeric values include:


$1.26, 23:12:45 and 03/07/47.

Potrebbero piacerti anche