SAS Applications Programming: A Gentle Introduction

SAS Applications Programming A Gentle Introduction
Frank C. DiIorio
1 Introduction
1.1 About SAS
1.2 Syntax Conventions
Summary

Part One


The Basics: SAS Terminology and Logic
2 The SAS Environment: Terminology and Basics
2.1 Building Blocks
2.2 Putting the Concepts to Work: An Annotated Example
Summary
3 Syntax Basics
3.1 Statements
3.2 Comments
3.3 Variables
3.4 Data Types
3.5 Missing Data
3.6 Constants
3.7 Expressions
Summary

Part Two


Simple Tasks, Simple Statistics: Reading and Analyzing Data
4 Data Step 1: Reading the Data
4.1 What kind of Data Can SAS Read?
4.2 Naming the Dataset: The DATA Statement
4.3 Identifying the Data Source
4.4 Describing the Data: The INPUT Statement
4.5 Sample Program for Reading a Dataset
4.6 Complete Examples of the DATA Step
Summary
5 Using the Dataset: Introduction to PROCs
5.1 Common Features of Procedures
5.2 Rearranging the Dataset: PROC SORT
5.3 Listing the Dataset: PROC PRINT
Summary
6 Descriptive Statistics
6.1 Univariate Statistics: PROC MEANS and PROC UNIVARIATE
6.2 Counting Categories: PROC FREQ
6.3 Pictorial Displays: PROC CHART
Summary

PART THREE


Redefining the Program
7 DATA Step II: Calculations
7.1 Numeric Assignment Statements: Syntax, Rules, and Examples
7.2 Numeric Functions
Summary
8 DATA Step III: Controlling the Flow of Execution
8.1 Conditional Execution: IF Statements
8.2 Bracketing Related Statements: DO-Groups
8.3 Restricting Output: OUTPUT, DELETE, and RETURN
Summary
9 DATA Step IV: Dressing Up and Trimming Down
9.1 Dressing Up: The Format Statement
9.2 Dressing Up: LABEL and ATTRIB Statements
9.3 Trimming Down: DROP and KEEP Statements
Summary
10 SAS Datasets
10.1 SAS Datasets in General
10.2 Permanent SAS Datasets
10.3 After the Fact: PROC Contents
10.4 After the Fact: PROC DATASETS
Summary
11 The DATA Step Revisited
11.1 Multiple Output Datasets
11.2 Controlling Storage: The LENGTH Statement
11.3 Defining Groups of Variables: The ARRAY Statement
11.4 Repetitive Execution: DO-Loops
11.5 Halting Execution: STOP and ABORT
11.6 Complex Raw Data: INPUT Revisited
11.7 INFILE Options
Summary

PART FOUR


Special Tools for Special Needs: Data Management and Reporting
12 Controlling the Environment: System Options
12.1 What Are OPTIONS?
12.2 Specifying OPTIONS
12.3 Frequently Used Options
12.4 The OPTIONS Procedure
Summary
13 Combining SAS Datasets
13.1 Data-Combining Basics
13.2 Concatenation
13.3 Interleaving
13.4 One-to-One Merge
13.5 Matched Merge
13.6 Updating
13.7 Common Errors
Summary
14 User-Written Formats I: Display
14.1 PROC FORMAT and Custom Formats
14.2 Permanent Format Libraries
Summary
15 User-Written Formats II: Recoding
15.1 Whats and Whys of Recoding
15.2 DATA Step Recoding
15.3 Recoding Directly in PROCs
Summary
16 Date Values
16.1 Date Value Concepts and Terminology
16.2 Reading Date Values
16.3 Date Constants
16.4 Date Calculations
16.5 Displaying Date Values
Summary
17 Creating Datasets with PROCs
17.1 MEANS Revisited
17.2 PROC Standard
17.3 PROC Rank
Summary
18 More About Character Data
18.1 Character-Data Principles
18.2 Input Statement Extension
18.3 Character Expressions
18.4 Character-Handling Functions
Summary
19 Advanced DATA Step Features
19.1 Calculations Across Observations: The RETAIN Statement
19.2 Identifying BY-Group Boundaries: FIRST. and LAST. Prefixes
19.3 Special Missing Values: The MISSING Statement
19.4 Automatic Variables: _N_ and _ERROR_
19.5 Data Management Extensions: END, NOBS, and POINT
19.6 Reading Raw Data: Extending INFILE and INPUT
19.7 Familiar Statements in Unfamiliar Places
Summary
20 Custom Reports
20.1 Custom Report Procs and Cons
20.2 Guidelines for Designing, Programming, and Testing Custom Reports
20.3 Report-Writing Statements
20.4 Examples of Custom Reports
Summary

PART FIVE


Statistics Revisited: Procedures for Bivariate and Multivariate Analysis
21 Two-Variable Graphics
21.1 Scatterplots: The PLOT Procedure
Summary
22 Bivariate Statistics
22.1 Contingency Tables: PROC FREQ
22.2 Comparing Distributions: PROC TTEST
22.3 Correlations: PROC CORR
Summary
23 Linear Regression
23.1 Regression Basics
23.2 Simple Diagnostics
23.3 Complications
23.4 The REG Procedure
23.5 Examples of the REG Procedure
Summary
24 Analysis of Variance
24.1 One-Way ANOVA
24.2 n-Way ANOVA
24.3 MANOVA
24.4 Repeated Measures
24.5 Cautions and Caveats
24.6 SAS Procedures for ANOVA
24.7 Examples of ANOVA and GLM
Summary
25 The Other 80
25.1 Base Product Features
25.2 Specialized Products
Summary
Some Conclusions About SAS
APPENDIXES
A The ASCII and EBCDIC Character Sets
A.1 Character Set Listings
B The SAS Style Sheet
B.1 Program Design
B.2 The DATA Step
B.3 Procedures
B.4 A Word About Style
C Getting Started at Your Installation
C.1 SAS-Specific Questions
C.2 System-Specific Questions
C.3 Resources: Where to Go for Help
D System-Specific Illustration
D.1 Operating Environments
D.2 IBM MVS/TSO
D.3 IBM VM/CMS
D.4 DEC VMS
D.5 PC/MS-DOS
E Sample Datasets
F What's New in Version 6.06
F.1 Improvements in Look and Feel
F.2 Improvements in Functionality
Answers

Index