没有合适的资源?快使用搜索试试~ 我知道了~
首页The Little SAS Book fifth edition.pdf
资源详情
资源评论
资源推荐


目录
The Little SAS Book—A Primer, Fifth Edition ....................................................................... i
Introducing SAS Software ........................................................................................................... vii
Overview ................................................................................................................................ vii
What's New ................................................................................................................................... ix
Chapter 1: Getting Started Using SAS Software ....................................................................... 1
1.1 The SAS Language ......................................................................................................... 1
1.2 SAS Data Sets ................................................................................................................. 4
1.3 DATA and PROC Steps .................................................................................................. 7
1.4 The DATA Step's Built-in Loop ....................................................................................... 9
1.5 Choosing a Mode for Submitting SAS Programs ...................................................... 11
1.6 Windows and Commands in the SAS Windowing Environment ............................. 14
The SAS Windows ....................................................................................................... 14
The SAS Commands ................................................................................................... 15
1.7 Submitting a Program in the SAS Windowing Environment ................................... 17
1.8 Reading the SAS Log .................................................................................................... 21
1.9 Viewing Your Results ..................................................................................................... 24
1.10 SAS Data Libraries ...................................................................................................... 26
1.11 Viewing Data Sets in the Viewtable Window ........................................................... 29
1.12 Viewing the Properties of Data Sets with SAS Explorer ........................................ 32
1.13 Using SAS System Options ....................................................................................... 35
Chapter 2: Getting Your Data into SAS ..................................................................................... 38
2.1 Methods for Getting Your Data into SAS .................................................................... 38
2.2 Entering Data with the Viewtable Window ................................................................. 41
2.3 Reading Files with the Import Wizard ......................................................................... 44
2.4 Telling SAS Where to Find Your Raw Data ................................................................ 47
2.5 Reading Raw Data Separated by Spaces ................................................................. 51
2.6 Reading Raw Data Arranged in Columns .................................................................. 54
2.7 Reading Raw Data Not in Standard Format .............................................................. 57
2.8 Selected Informats ......................................................................................................... 60
2.9 Mixing Input Styles ........................................................................................................ 62
2.10 Reading Messy Raw Data .......................................................................................... 65
2.11 Reading Multiple Lines of Raw Data per Observation ........................................... 68
2.12 Reading Multiple Observations per Line of Raw Data ........................................... 71
2.13 Reading Part of a Raw Data File ............................................................................... 73
2.14 Controlling Input with Options in the INFILE Statement ........................................ 76
2.15 Reading Delimited Files with the DATA Step ........................................................... 79
2.16 Reading Delimited Files with the IMPORT Procedure ........................................... 83
2.17 Reading Excel Files with the IMPORT Procedure .................................................. 86
2.18 Temporary versus Permanent SAS Data Sets ........................................................ 89
2.19 Using Permanent SAS Data Sets with LIBNAME Statements ............................. 93
2.20 Using Permanent SAS Data Sets by Direct Referencing ...................................... 96
2.21 Listing the Contents of a SAS Data Set ................................................................... 99

Chapter 3: Working With Your Data ......................................................................................... 103
3.1 Creating and Redefining Variables ............................................................................ 103
3.2 Using SAS Functions .................................................................................................. 106
3.3 Selected SAS Character Functions .......................................................................... 109
3.4 Selected SAS Numeric Functions ............................................................................. 113
3.5 Using IF-THEN Statements ........................................................................................ 117
3.6 Grouping Observations with IF-THEN/ELSE Statements ..................................... 120
3.7 Subsetting Your Data .................................................................................................. 123
3.8 Working with SAS Dates ............................................................................................. 126
3.9 Selected Date Informats, Functions, and Formats ................................................. 130
3.10 Using the RETAIN and Sum Statements ............................................................... 134
3.11 Simplifying Programs with Arrays ............................................................................ 137
3.12 Using Shortcuts for Lists of Variable Names ......................................................... 140
Chapter 4: Sorting, Printing, and Summarizing Your Data ................................................... 144
4.1 Using SAS Procedures ............................................................................................... 144
4.2 Subsetting in Procedures with the WHERE Statement ......................................... 148
4.3 Sorting Your Data with PROC SORT ........................................................................ 151
4.4 Changing the Sort Order for Character Data ........................................................... 154
4.5 Printing Your Data with PROC PRINT ...................................................................... 157
4.6 Changing the Appearance of Printed Values with Formats ................................... 161
4.7 Selected Standard Formats ....................................................................................... 164
4.8 Creating Your Own Formats Using PROC FORMAT ............................................. 168
4.9 Writing Simple Custom Reports ................................................................................ 171
4.10 Summarizing Your Data Using PROC MEANS ..................................................... 174
4.11 Writing Summary Statistics to a SAS Data Set ..................................................... 177
4.12 Counting Your Data with PROC FREQ .................................................................. 180
4.13 Producing Tabular Reports with PROC TABULATE ............................................. 183
4.14 Adding Statistics to PROC TABULATE Output ..................................................... 186
4.15 Enhancing the Appearance of PROC TABULATE Output ................................... 189
4.16 Changing Headers in PROC TABULATE Output .................................................. 192
4.17 Specifying Multiple Formats for Data Cells in PROC TABULATE Output ......... 195
4.18 Producing Simple Output with PROC REPORT ................................................... 198
4.19 Using DEFINE Statements in PROC REPORT .................................................... 201
4.20 Creating Summary Reports with PROC REPORT ............................................... 204
4.21 Adding Summary Breaks to PROC REPORT Output .......................................... 207
4.22 Adding Statistics to PROC REPORT Output ......................................................... 210
4.23 Adding Computed Variables to PROC REPORT Output ..................................... 213
4.24 Grouping Data in Procedures with User-Defined Formats .................................. 216
Chapter 5: Enhancing Your Output with ODS ........................................................................ 219
5.1 Concepts of the Output Delivery System ................................................................. 219
5.2 Tracing and Selecting Procedure Output ................................................................. 222
5.3 Creating SAS Data Sets from Procedure Output .................................................... 226
5.4 Creating Text Output ................................................................................................... 229
5.5 Creating HTML Output ................................................................................................ 232

5.6 Creating RTF Output ................................................................................................... 235
5.7 Creating PDF Output ................................................................................................... 238
5.8 Customizing Titles and Footnotes ............................................................................. 241
5.9 Customizing PROC PRINT with the STYLE= Option ............................................. 244
5.10 Customizing PROC REPORT with the STYLE= Option ...................................... 247
5.11 Customizing PROC TABULATE with the STYLE= Option ................................... 250
5.12 Adding Traffic-Lighting to Your Output .................................................................... 253
5.13 Selected Style Attributes........................................................................................... 256
Chapter 6: Modifying and Combining SAS Data Sets .......................................................... 260
6.1 Modifying a Data Set Using the SET Statement ..................................................... 260
6.2 Stacking Data Sets Using the SET Statement ........................................................ 263
6.3 Interleaving Data Sets Using the SET Statement ................................................... 266
6.4 Combining Data Sets Using a One-to-One Match Merge ..................................... 269
6.5 Combining Data Sets Using a One-to-Many Match Merge ................................... 273
6.6 Merging Summary Statistics with the Original Data ............................................... 276
6.7 Combining a Grand Total with the Original Data ..................................................... 279
6.8 Updating a Master Data Set with Transactions ....................................................... 282
6.9 Writing Multiple Data Sets Using the OUTPUT Statement .................................... 286
6.10 Making Several Observations from One Using the OUTPUT Statement ......... 289
6.11 Using SAS Data Set Options ................................................................................... 292
6.12 Tracking and Selecting Observations with the IN= Option .................................. 295
6.13 Selecting Observations with the WHERE= Option ............................................... 298
6.14 Changing Observations to Variables Using PROC TRANSPOSE ..................... 301
6.15 Using SAS Automatic Variables .............................................................................. 304
Chapter 7: Writing Flexible Code with the SAS Macro Facility............................................ 307
7.1 Macro Concepts ........................................................................................................... 307
7.2 Substituting Text with Macro Variables ..................................................................... 310
7.3 Concatenating Macro Variables with Other Text ..................................................... 313
7.4 Creating Modular Code with Macros ........................................................................ 316
7.5 Adding Parameters to Macros ................................................................................... 319
7.6 Writing Macros with Conditional Logic ...................................................................... 322
7.7 Writing Data-Driven Programs with CALL SYMPUT .............................................. 326
7.8 Debugging Macro Errors ............................................................................................ 329
Chapter 8: Visualizing Your Data ............................................................................................. 332
8.1 Concepts of ODS Graphics ........................................................................................ 332
8.2 Creating Bar Charts ..................................................................................................... 336
8.3 Creating Histograms and Density Curves ................................................................ 339
8.4 Creating Box Plots ....................................................................................................... 342
8.5 Creating Scatter Plots ................................................................................................. 345
8.6 Creating Series Plots .................................................................................................. 347
8.7 Creating Fitted Curves ................................................................................................ 349
8.8 Controlling Axes and Reference Lines ..................................................................... 352
8.9 Controlling Legends and Insets ................................................................................. 355
8.10 Customizing Graph Attributes .................................................................................. 358

8.11 Creating Paneled Graphs ......................................................................................... 361
8.12 Specifying Image Properties and Saving Graphics Output ................................. 364
Chapter 9: Using Basic Statistical Procedures ...................................................................... 367
9.1 Examining the Distribution of Data with PROC UNIVARIATE ............................... 367
9.2 Creating Statistical Graphics with PROC UNIVARIATE......................................... 370
9.3 Producing Statistics with PROC MEANS ................................................................. 373
9.4 Testing Means with PROC TTEST ............................................................................ 376
9.5 Creating Statistical Graphics with PROC TTEST ................................................... 379
9.6 Testing Categorical Data with PROC FREQ ............................................................ 382
9.7 Creating Statistical Graphics with PROC FREQ ..................................................... 385
9.8 Examining Correlations with PROC CORR ............................................................. 388
9.9 Creating Statistical Graphics with PROC CORR .................................................... 391
9.10 Using PROC REG for Simple Regression Analysis ............................................. 394
9.11 Creating Statistical Graphics with PROC REG ..................................................... 397
9.12 Using PROC ANOVA for One-Way Analysis of Variance .................................... 400
9.13 Reading the Output of PROC ANOVA .................................................................... 403
Chapter 10: Exporting Your Data ............................................................................................. 406
10.1 Methods for Exporting Your Data ............................................................................ 406
10.2 Writing Files Using the Export Wizard .................................................................... 408
10.3 Writing Delimited Files with the EXPORT Procedure........................................... 411
10.4 Writing Microsoft Excel Files with the EXPORT Procedure ................................ 414
10.5 Writing Raw Data Files with the DATA Step .......................................................... 417
10.6 Writing Delimited and HTML Files Using ODS ...................................................... 420
Chapter 11: Debugging Your SAS Programs ......................................................................... 423
11.1 Writing SAS Programs That Work ........................................................................... 423
11.2 Fixing Programs That Don't Work ........................................................................... 426
11.3 Searching for the Missing Semicolon ..................................................................... 430
11.4 Note: INPUT Statement Reached Past the End of a Line ................................... 434
11.5 Note: Lost Card .......................................................................................................... 438
11.6 Note: Invalid Data ...................................................................................................... 442
11.7 Note: Missing Values were Generated ................................................................... 445
11.8 Note: Numeric Values Have Been Converted to Character (or Vice Versa) ..... 448
11.9 DATA Step Produces Wrong Results but No Error Message .............................. 451
11.10 Error: Invalid Option, Error: The Option Is Not Recognized, or Error: Statement
Is Not Valid .......................................................................................................................... 454
11.11 Note: Variable Is Uninitialized or Error: Variable Not Found .............................. 457
11.12 SAS Truncates a Character Variable .................................................................... 460
11.13 SAS Stops in the Middle of a Program ................................................................. 464
11.14 SAS Runs Out of Memory or Disk Space ............................................................ 467
Appendix—Coming to SAS from SQL ..................................................................................... 470
Overview .............................................................................................................................. 470
剩余492页未读,继续阅读















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0