Course Notes
Table of Contents
Course Description...................................................................................................................... vi
Prerequisites ..............................................................................................................................viii
General Conventions ................................................................................................................... ix
Chapter 1 Introduction ................................................................................................. 1
1.1 An Overview of the SAS System ......................................................................................... 3
Chapter 2 Getting Started with the SAS® System ...................................................... 9
2.1 Introduction to SAS Programs ........................................................................................... 11
2.2 Running SAS Programs ..................................................................................................... 16
2.3 Mastering Fundamental Concepts ...................................................................................... 39
2.4 Diagnosing and Correcting Syntax Errors.......................................................................... 49
2.5 Exploring Your SAS Environment (Self-Study) ................................................................ 60
2.6 Solutions to Exercises ........................................................................................................ 75
Chapter 3 Getting Familiar with SAS® Data Sets...................................................... 77
3.1 SAS Data Libraries............................................................................................................. 79
3.2 Solutions to Exercises ........................................................................................................ 91
Chapter 4 Producing List Reports............................................................................. 93
4.1 Getting Started with the PRINT Procedure ........................................................................ 95
4.2 Sequencing and Grouping Observations .......................................................................... 106
4.3 Identifying Observations (Self-Study) ............................................................................. 114
4.4 Special WHERE Statement Operators (Self-Study)......................................................... 119
4.5 Solutions to Exercises ...................................................................................................... 122
iv For Your Information
Chapter 5 Enhancing Output ................................................................................... 125
5.1 Customizing Report Appearance...................................................................................... 127
5.2 Formatting Data Values .................................................................................................... 132
5.3 Creating HTML Reports................................................................................................... 145
5.4 Solutions to Exercises ...................................................................................................... 151
Chapter 6 Creating SAS® Data Sets......................................................................... 153
6.1 Reading Raw Data Files: Column Input........................................................................... 155
6.2 Reading Raw Data Files: Formatted Input ....................................................................... 172
6.3 Examining Data Errors..................................................................................................... 181
6.4 Assigning Variable Attributes........................................................................................... 191
6.5 Changing Variable Attributes (Self-Study)....................................................................... 198
6.6 Reading Excel Spreadsheets (Self-Study) ........................................................................ 213
6.7 Solutions to Exercises ...................................................................................................... 226
Chapter 7 DATA Step Programming ........................................................................ 231
7.1 Reading SAS Data Sets and Creating Variables............................................................... 233
7.2 Conditional Processing..................................................................................................... 245
7.3 Dropping and Keeping Variables (Self-Study)................................................................. 261
7.4 Reading Excel Spreadsheets Containing Date Fields (Self-Study) .................................. 264
7.5 Solutions to Exercises ...................................................................................................... 269
Chapter 8 Combining SAS® Data Sets ..................................................................... 273
8.1 Concatenating SAS Data Sets .......................................................................................... 275
8.2 Merging SAS Data Sets.................................................................................................... 286
8.3 Combining SAS Data Sets: Additional Features (Self-Study) ......................................... 306
For Your Information v
8.4 Solutions to Exercises ...................................................................................................... 309
Chapter 9 Producing Summary Reports................................................................. 313
9.1 Introduction to Summary Reports .................................................................................... 315
9.2 Basic Summary Reports ................................................................................................... 318
9.3 The REPORT Procedure................................................................................................... 335
9.4 The TABULATE Procedure (Self-Study)......................................................................... 350
9.5 Solutions to Exercises ...................................................................................................... 365
Chapter 10 Introduction to Graphics (Optional)..................................................... 369
10.1 Producing Bar and Pie Charts ........................................................................................ 371
10.2 Enhancing Output........................................................................................................... 384
10.3 Producing Plots .............................................................................................................. 392
10.4 Solutions to Exercises .................................................................................................... 402
Chapter 11 Additional Resources............................................................................ 405
11.1 Resources........................................................................................................................ 407
- SAS Programming I Essentials(course notes).pdf