TheLittleSASBook
The Little SAS BookContentsAcknowledgments ixIntroducing SAS Software xabout this book xiWhat's New xivChapter 1 Getting Started Using SAS Software 11.1 The sas language 21.2 SAS Data Sets 41.3 The Two Parts of a SAS Program 61.4 The DATA Step's Built-in Loop 81.5 Choosing a Mode for Submitting SAS Programs 101.6 Windows and Commands in the sas Windowing Environment 121.7 Submitting a Program in the SAS Windowing Environment 141.8 Reading the SAS Log 161.9 Viewing Your Results in the Output Window 181.10 Creating HTML Output 201.11 SAS Data Libraries 221.12 Viewing data Sets in the viewtable window 241.13 Viewing the Properties of Data Sets with SAS Explorer 261.14 USing SAS System Options 28Chapter 2 Getting Your Data into SAs 312.1 Methods for Getting your data into sas 322.2 Entering data with the viewable window2.3 Reading Files with the Import Wizard 362.4 Telling SAS Where to Find Your Raw Data 38P2.6 Reading Raw Data Arranged in Columns 422.7 Reading raw Data not in Standard Format 442. 8 Selected Informats 462. 9 Mixing Input styles 482.10 Reading messy Raw Data 50Contents2.11 Reading multiple lines of raw Data per Observation 522.12 Reading Multiple observations per Line of Raw Data 542.13 Reading paRaw Data file 562.14 Controlling Input with Options in the INFILE Statement 582.15 Reading Delimited Files with the DATA Step 602.16 Reading delimited Files with the IMPORT Procedure 622.17 Reading PC Files with the IMPORT Procedure 642.18 Reading PC Files with DDE 662.19 Temporary versus Permanent sas data Sets 682.20 USing Permanent SAS Data Sets with LIBNAME Statements 702.21 USing Permanent SAS Data Sets by Direct Referencing 722.22 Listing the Contents of a SAS Data Set 74Chapter 3 Working with Your Data 773.1 Creating and Redefining variables 783. 2 Using SAS Functions3.3 Selected SAs Character Functions 823.4 Selected sAs Numeric Functions3.5 Using if-then statements 863.6 Grouping Observations with IF-THEN/ELSE Statements 883.7 Subsetting y3.8 Working with SAs Dates 923.9 Selected Date Informats, Functions, and Formats 943.10 Using the retaiN and Sum Statements3.11 Simplifying Programs with Arrays 983.12 Using shortcuts for Lists of variable names 100Chapter 4 Sorting, Printing, and Summarizing Your Data 1034.1 Using sas procedures 1044.2 Subsetting in Procedures with the Where Statement 1064.3 Sorting Your Data with PROC SORT 1084.4 Printing Your data with PROC PRINT 1104.5 Changing the Appearance of Printed Values with Formats 1124.6 Selected Standard Formats 1144.7 Creating Your Own Formats Using PROC FORMAT 1164.8 Writing Simple Custom Reports 1184.9 Summarizing Your Data Using PROC MEANS 1204.10 Writing Summary Statistics to a SAS Data Set 1224.11 Counting Your Data with PROC FREQ 1244.12 Producing Tabular Reports with PROC TABULATE 1264.13 Adding statistics to PROC TABULATE Output 1284.14 Enhancing the Appearance of PROC TABULATE Out1304.15 Changing headers in PRoC TaBula te Output 1324.16 Specifying Multiple Formats for Data Cells in PROC TABULATE Output 1344.17 Producing Simple Output with PROC REPORT 1364.18 Using DEFINE Statements in PROC REPORT 1384.19 Creating Summary Reports with PROC REPORT 1404.20 Adding Summary Breaks to PROC REPORT Output 1424.21 Adding Statistics to PROC REPORT Output 1444.22 Adding Computed Variables to PROC REPORT Output 1464.23 Grouping data in procedures with User-Defined Formats 148Chapter 5 Enhancing Your Output with ODs 1515.1 Concepts of the Output Delivery System 1525.2 Tracing and Selecting Procedure Output 154SAS Data Sets from procedure output 1565.4 USing ODS Statements to Create HTML Output 1585.5 Using ODS Statements to Create RTF Output 1605.6 Using ODS Statements to Create PRINTER Output 1625.7 Customizing Titles and Footnotes 1645.8 Customizing PROC PRINT Output with the STYLE= Option 1665.9 Customizing PROC. REPORT Output with the STYLE= Option 1685.10 Customizing PROC TABULaTE Output with the STYlE= Option 1705.11 Adding Traffic-Lighting to Your Output 1725. 12 Selected Style Attributes 174Chapter 6 Modifying and Combining SAS Data Sets 1776.1 Modifying a Data Set Using the SET Statement 1786.2 Stacking Data Sets Using the SET Statement 1806.3 Interleaving Data Sets USing the SET Statement 1826.4 Combining Data Sets Using a One-to-Onc Match Merge 1846.5 Combining Data Sets Using a One-to-Many Match Merge 1866.6 Merging summary statistics with the Original Data 1886.7 Combining a Grand Total with the Original Data 1906.8 Updating a Master Data Set with Transactions 192Contents6. 9 Writing Multiple data Sets Using the OUTPUT Statement 1946.10 Making Several Observations from One Using the OUTPUT Statement 1966.11 USing SAS Data Set Options 1986.12 Tracking and Selecting Observations with the IN= Option 2006.13 Selecting Observations with the WHERE= Option 2026.14 Changing Observations to Variables Using PROC TRANSPOSE 2046.15 Using sas automatic variables 206Chapter 7 Writing Flexible Code with the SAs Macro Facility 2097.1 Macro Concepts 2107. 2 Substituting Text with Macro Variables 2127.3 Creating Modular Code with Macros 2147.4 Adding Parameters to Macros 2167.5 Writing Macros with Conditional Logic 2187.6 Writing Data-Driven Programs with CALL SYMPUT 2207.7 Debugging Macro Errors 222Chapter8 USing Basic Graphical and Statistical Procedures 2258.1 Concepts of Ods graphics 28.2 Creating bar Charts with PROC sgPlot 2288.3 Creating Histograms and Box Plots with PROC SGPLOT 2308.4 Creating Scatter Plots with PROC SGPLOT 2328.5 Creating Series Plots with PROC SGPLOT 2348.6 Creating Fitted Curves with PROC SgPlOt 2368.7 Examining the Distribution of Data with PROC UNIVARIATE 2388.8 Creating Statistical Graphics with PROC UNIV ARIATE 2408.9 Producing statistics with PROC MEANs 2428.10 Testing Categorical Data with PROC FreQ 2448. 11 Creating Statistical Graphics with PROC FreQ 2468.12 Examining Correlations with PROC CORr 2488.13 Creating Statistical Graphics with PROC CORR 2508.14 USing PROC REG for Simple Regression Analysis 2528.15 Creating Statistical graphics with PROC REG 2548.16 USing PROC ANOVA for One-Way Analysis of Variance 2568. 17 Reading the output of Proc anova 258ContentsExporting Your Data 2619.1 Methods for Exporting Your Data 2629.2 Writing Files using the export Wizard 2649.3 Writing delimited Files with the eXPOrt Procedure 2669. 4 Writing PC Files with the eXPORT Procedure 2689.5 Writing Raw Data Files with the data Step 2709.6 Writing Delimited and HTML Files Using ODS 2729.7 Sharing sas data Sets with Other Types of Computers 274Chapter 10 Debugging Your SAS Programs 27710.1 Writing SAS Programs That Work 27810.2 Fixing Programs That Dont Work 28010.3 Searching for the Missing Semicolon 28210.4 Note: INPUT Statement Reached past the End of the line 28410.5 Note: Lost Card 28610.6 Note: Invalid Data 28810.7 Note: Missing values Were generated 29010.8 Note: Numeric Values Have Been Converted to Character(or Vice Versa) 29210.9 DatA Step produces Wrong results but No Error message 29410.10 The DATA Step Debugger 29610.11 Error: Invalid Option, Error: The Option Is Not Recognized,or error: statement Is not valid 29 810.12 Note: Variable is uninitialized or error. variable not found 30010.13 SAS Truncates a Character variable 30210.14 SAS Stops in the middle of a job 30410.15 SAS Runs Out of Memory or Disk Space 306ppendix a Where to Go from Here 310Appendix B Coming to SAS from SPSS 312Appendix C Coming to SAS from a Programming Language 32Appendix d Coming to SAS from SQL 326Index 335AcknowledgmentsAs hard as we have worked on this book, we could never have done it alone. Many people at Sashelped make this book what it is. To our many hard-working reviewers: Janice Bloom, AmberElam, Phil Gibbs, Chris Hemedinger, Elizabeth Maldonado, Lelia McConnell, Julie McknightMartin Mincey, Jason Moore, Sandy Owens, and Cynthia Zender, we say, Thanks for hanging inthere with us. Special thanks go to reviewers Bob Rodriguez, Sanjay Matange, and Dan Heath,Without you, we couldn 't have included OdS graphics in this edition. To our copyeditor, MikeBoyd, and our designer, Patrice Cherry, Thanks for making us look good. To our technicalpublishing specialists, Jennifer Dilley and Candy Farrell,Thanks for rectifying all those waywardfootnotes, squeezing in those last few sentences, and finding those missing images. "And last butnot least we would like to thank--faster than a speeding deadline, stronger than microsoft Wordable to leap tall drafts in a single bound--our editor-in-chief, Julie Platt; managing editor, MaryBeth Steinbach; and acquisitions editor Stephenie JoynerOutside the walls of sas many other people also contributed to this book. In particular we wouldlike to thank our readers. We love meeting you at conferences even if we seem a little shy. Withoutyou, of course there would be no reason to keep writing Most of all we would like to thank ourfamilies for their understanding and suppor
用户评论