6
Math 3400 Computer Applications of Statistics Lecture 1 Introduction and SAS Overview

Math 3400 Computer Applications of Statistics Lecture 1 Introduction and SAS Overview

Embed Size (px)

Citation preview

Page 1: Math 3400 Computer Applications of Statistics Lecture 1 Introduction and SAS Overview

Math 3400Computer Applications of

Statistics

Lecture 1

Introduction and SAS Overview

Page 2: Math 3400 Computer Applications of Statistics Lecture 1 Introduction and SAS Overview

SAS Overview

• What is SAS?– Statistical Analysis System - a statistical and information

system that performs sophisticated data management and statistical analysis

• Why Learn SAS?– More powerful than Excel, SPSS for sophisticated data

analysis work– 95% of the Fortune 500 Companies use SAS– Over 3.5 Million Users– Installed in over 118 countries– Another “tool” in your toolbox

Page 3: Math 3400 Computer Applications of Statistics Lecture 1 Introduction and SAS Overview

SAS Overview

– Major Features File manipulations, especially appending or merging

two or more files together

Processing survey data

Categorical Data Analysis

Data processing tasks requiring programming steps

Processing or manipulating extra large data files

Page 4: Math 3400 Computer Applications of Statistics Lecture 1 Introduction and SAS Overview

SAS Basics – Program Elements

• KEYWORDS - special words that SAS recognizes will tell it a specific instruction (e.g., DATA, PROC, SET, ARRAY, RETAIN, INFILE)

• STATEMENTS – commands that tell SAS what to do. – usually begin with a single SAS keyword (except formulas), followed by

various options – always end with a semi-colon

• STEPS - A typical SAS program consists of a sequence of DATA and PROC steps– DATA Step - block of statements to create a SAS data set – PROC Step - A block of statements that perform a specified data analysis

procedure

• RUN; – used to specify the end of a DATA or PROC step;– tells SAS to process all statements that appear since the most recent

DATA or PROC statement;

Page 5: Math 3400 Computer Applications of Statistics Lecture 1 Introduction and SAS Overview

• DATA Steps– Create and manipulate SAS data sets– Read data from external files– Naming/labeling variables– Create new variables from existing

(composite/transformation)– Custom output (create new data sets)– DATA Step Statements

• PROC Steps– Data manipulation and processing (sorting, transformation)– Standard reports and chart output– Statistical Analyses

• Running the Program– Highlight the syntax and press F3 or click Run;– type SUBMIT at the command box right below the menu bar

or; – click your right mouse button and select LOCAL, SUBMIT.

SAS Basics – The SAS Program

Page 6: Math 3400 Computer Applications of Statistics Lecture 1 Introduction and SAS Overview

SAS Basics – Debugging the SAS program• Always Read the LOG File!

• always produced with each job submitted • summarizes what actually happened when you ran the program. • checks for syntax errors

• To Minimize Errors when Editing SAS Programs End SAS statements with a semi-colon (probably the most common error!) Quotes always come in pairs of the same type: 'text'; or "text"; and not "text'; or

'text .. ; Use 'short' variable names with LABELS to provide longer descriptions Use one statement per line Use upper and lower case letters to distinguish SAS keywords from variable names or

selected options Leave a blank row between blocks of statements included in each DATA and PROC

step File Management: store your programs and data in subdirectories indicating project

type Practice, Practice, Practice - experience makes it natural and easy to use Learn from your mistakes

"The fastest way to succeed is to double your failure rate." -Thomas J. Watson, Sr. Founder of IBM