SAS Applications Programming: A Gentle Introduction Table of ...

4 downloads 74 Views 146KB Size Report
SAS Applications Programming: A Gentle Introduction Table of Contents. Introduction 1. 1.1 About SAS 1. 1.2 Syntax Conventions 2. Summary 3. PART ONE.
SAS Applications Programming: A Gentle Introduction Table of Contents Introduction 1 1.1 About SAS 1 1.2 Syntax Conventions 2 Summary 3

PART ONE The Basics: SAS Terminology and Logic 2

The SAS Environment: Terminology and Basics 7 2.1 Building Blocks 7 2.2 Putting the Concepts to Work: An Annotated Example 11 Summary 21

3

Syntax Basics 23 3.1 Statements 24 3.2 Comments 25 3.3 Variables 28 3.4 Data Types 33 3.5 Missing Data 35 3.6 Constants 37 3.7 Expressions 39 Summary 46

PART TWO Simple Tasks, Simple Statistics: Reading and Analyzing Data 4

Data Step I: Reading the Data 49 4.1 What kind of Data Can SAS Read? 49 4.2 Naming the Dataset: The DATA Statement 50 4.3 Identifying the Data Source 50 4.4 Describing the Data: The INPUT Statement 52 4.5 Sample Program for Reading a Dataset 55 4.6 Complete Examples of the DATA Step 61 Summary 62

5

Using the Dataset: Introduction to PROCs 65 5.1 Common Features of Procedures 65 5.2 Rearranging the Dataset: PROC SORT 75 5.3 Listing the Dataset: PROC PRINT 77 Summary 86

6

Descriptive Statistics 87 6.1 Univariate Statistics: PROC MEANS and PROC UNIVARIATE 88 6.2 Counting Categories: PROC FREQ 99 6.3 Pictorial Displays: PROC CHART 102 Summary 121

PART THREE Refining the Program 7

DATA Step II: Calculations 125 7.1 Numeric Assignment Statements: Syntax, Rules/ and Examples 125 7.2 Numeric Functions 128 Summary 140

8

DATA Step III: Controlling the Flow of Execution 143 8.1 Conditional Execution: IF Statements 143 8.2 Bracketing Related Statements: DO-Groups 147 8.3 Restricting Output: OUTPUT, DELETE, and RETURN 150 Summary 154

9

DATA Step IV: Dressing Up and Trimming Down 155 9.1 Dressing Up: The Format Statement 155 9.2 Dressing Up: LABEL and ATTRIB Statements 162 9.3 Trimming Down: DROP and KEEP Statements 164

SAS Applications Programming: A Gentle Introduction Table of Contents Summary 166 10

11

SAS Datasets 167 10.1 SAS Datasets in General 167 10.2 Permanent SAS Datasets 170 10.3 After the Fact: PROC Contents 180 10.4 After the Fact: PROC DATASETS 182 Summary 192 The DATA Step Revisited 193 11.1 Multiple Output Datasets 193 11.2 Controlling Storage: The LENGTH Statement 196 11.3 Defining Groups of Variables: The ARRAY Statement 199 11.4 Repetitive Execution: DO-Loops 202 11.5 Halting Execution: STOP and ABORT 209 11.6 Complex Raw Data: INPUT Revisited 210 11.7 INFILE Options 221 Summary 225

PART FOUR Special Tools for Special Needs: Data Management and Reporting 12

Controlling the Environment: System Options 229 12.1 What Are OPTIONS? 229 12.2 Specifying OPTIONS 230 12.3 Frequently Used Options 231 12.4 The OPTIONS Procedure 240 Summary 242

13

Combining SAS Datasets 245 13.1 Data-Combining Basics 245 13.2 Concatenation 250 13.3 Interleaving 253 13.4 One-to-One Merge 256 13.5 Matched Merge 262 13.6 Updating 269 13.7 Common Errors 273 Summary 277

14

User-Written Formats I: Display 279 14.1 PROC FORMAT and Custom Formats 279 14.2 Permanent Format Libraries 288 Summary 292

15

User-Written Formats II: Receding 293 15.1 Whats and Whys of Receding 293 15.2 DATA Step Receding 294 15.3 Recoding Directly in PROCs 299

16

Date Values 305 16.1 Date Value Concepts and Terminology 306 16.2 Reading Date Values 307 16.3 Date Constants 309 16.4 Date Calculations 310 16.5 Displaying Date Values 316

17

Creating Datasets with PROCs 321 17.1 MEANS Revisited 321 17.2 PROC Standard 335 17.3 PROC Rank 338

18

More About Character Data 343 18.1 Character-Data Principles 343 18.2 Input Statement Extension 345 18.3 Character Expressions 346J 18.4 Character-Handling Functions 349

SAS Applications Programming: A Gentle Introduction Table of Contents 19

Advanced DATA Step Features 363 19.1 Calculations Across Observations: The RETAIN Statement 363 19.2 Identifying BY-Group Boundaries: FIRST, and LAST. Prefixes 367 19.3 Special Missing Values: The MISSING Statement 372 19.4 Automatic Variables:-N-and-ERROR-378 I 19.5 Data Management Extensions: END/ NOBS, and POINT 380 19.6 Reading Raw Data: Extending INFILE and INPUT 383 19.7 Familiar Statements in Unfamiliar Places 389

20

Custom Reports 395 20.1 Custom Report Pros and Cons 395 20.2 Guidelines for Designing/ Programming, and Testing Custom Reports 396 20.3 Report-Writing Statements 397 20.4 Examples of Custom Reports 403 Summary 423

PART FIVE Statistics Revisited: Procedures for Bivariate and Multivariate Analysis 21

Two-Variable Graphics 427 21.1 Scatterplots: The PLOT Procedure 427 Summary 447

22

Bivariate Statistics 449 22.1 Contingency Tables: PROC FREQ 449 22.2 Comparing Distributions: PROC TTEST 462 22.3 Correlations: PROC CORR 468 Summary 482

23

Linear Regression 483 23.1 Regression Basics 483 23.2 Simple Diagnostics 485 23.3 Complications 487 23.4 The REG Procedure 492 23.5 Examples of the REG Procedure 500 Summary 515

24

Analysis of Variance 517 24.1 One-Way ANOVA 517 24.2 n-Way ANOVA 519 24.3 MANOVA 521 24.4 Repeated Measures 521 24.5 Cautions and Caveats 521 24.6 SAS Procedures for ANOVA 522 24.7 Examples of ANOVA and GLM 532 Summary 548

25

The Other 80 549 25.1 Base Product Features 549 25.2 Specialized Products 565 Summary 573 Some Conclusions About SAS 573

APPENDIXES A

The ASCII and EBCDIC Character Sets 575 A.I Character Set Listings 576

B

The SAS Style Sheet 579 B.I Program Design 579 B.2 The DATA Step 582 B.3 Procedures 585 B.4 A Word About Style 586

C

Getting Started at Your Installation 587 C.I SAS-Specific Questions 587

SAS Applications Programming: A Gentle Introduction Table of Contents C.2 System-Specific Questions 588 C.3 Resources: Where to Go for Help 589 D

System-Specific Illustrations 593 D.I Operating Environments 593 D.2 IBM MVS/TSO 596 D.3 IBM VM/CMS 604 D.4 DEC VMS 608 D.5 PC/MS-DOS 612

E

Sample Datasets 617

F

What's New in Version 6.06 633 F.I Improvements in Look and Feel 633 F.2 Improvements in Functionality 634

Answers 639 Index 675

Suggest Documents