Statistical Programming in SAS
Häftad, Engelska, 2019
1 399 kr
Finns i fler format (1)
Produktinformation
- Utgivningsdatum2019-12-09
- Mått178 x 254 x 32 mm
- Vikt700 g
- SpråkEngelska
- Antal sidor378
- Upplaga2
- FörlagTaylor & Francis Ltd
- EAN9780367357979
Tillhör följande kategorier
A. John Bailer, PhD, PStat®, is a University Distinguished Professor and a founding chair of the Department of Statistics and an affiliate member of the Departments of Biology and Sociology and Gerontology as well as the Institute for the Environment and Sustainability at the Miami University in Oxford, Ohio. He is President of the International Statistical Institute (2019–2021). He previously served on the Board of Directors of the American Statistical Association. He is a Fellow of the American Statistical Association, the Society for Risk Analysis, and the American Association for the Advancement of Science. His research has focused on the quantitative risk estimation but has collaborations addressing problems in toxicology, environmental health, and occupational safety. He received the E. Phillips Knox Distinguished Teaching Award in 2018 after previously receiving the Distinguished Teaching Award for Excellence in Graduate Instruction and Mentoring and the College of Arts and Science Distinguished Teaching Award. He is also the co-founder and continuing panelist on the Stats+Stories podcast (www.statsandstories.net).
- ContentsPreface ..............................................................................................................................................ixAcknowledgments ...................................................................................................................... xiiiAuthor .............................................................................................................................................xv1. Structuring, Implementing, and Debugging Programs to Learn about Data ...........11.1 Statistical Programming ................................................................................................11.2 Learning from Constructed, Artificial Data ...............................................................2Processing a Particular Data Set—Extracting Variable Names from aColumn of an Input Data Set.........................................................................................2Learning More about Unfamiliar Statistical Methods—Linear MixedEffects Models .................................................................................................................5Improving Your Intuition about Statistical Theory— Sampling Distributionof Means ...........................................................................................................................81.3 Good Programming Practice ...................................................................................... 11Document Your Programs! .......................................................................................... 11Use Meaningful Variable Names ................................................................................ 13Use a Variety of CaSeS in Program Statements ........................................................ 14Indent Program Statements That Naturally Go Together ....................................... 141.4 SAS Program Structure ................................................................................................ 151.5 What Is a SAS Data Set? ............................................................................................... 211.6 Internally Documenting SAS Programs ....................................................................221.7 Basic Debugging ...........................................................................................................231.8 Getting Help ..................................................................................................................27Using Help in SAS ........................................................................................................27Getting Help from a Web Browser Search .................................................................291.9 Exercises .........................................................................................................................292. Reading, Creating, and Formatting Data Sets ................................................................ 312.1 What Does a SAS DATA Step Do? .............................................................................. 312.2 Reading Data from External Files ..............................................................................33Reading Data Directly as Part of a Program—Anyone for Datalines? .................34Reading Data Sets Saved as Text—INFILE Can Be Your Friend (PROCIMPORT Too!) ................................................................................................................38Sometimes, Variables Are in Particular Columns or in Particular Formats .........402.3 Reading CSV, Excel, and TEXT Files .......................................................................... 412.4 Temporary versus Permanent Status of Data Sets ...................................................432.5 Formatting and Labeling Variables ............................................................................46Using Formats to Read and Display Variable Values ..............................................46Internal Representations and Output Displays ........................................................49Character, Numeric, Time, and Date Formats ..........................................................532.6 User-Defined Formatting .............................................................................................58Saving Formats for Later Use ......................................................................................632.7 Recoding and Transforming Variables in a DATA Step ........................................66Indicator Variables ......................................................................................................682.8 Writing Out a File or Making a Simple Report ......................................................73Simple Report Generation .........................................................................................73Exporting a File ...........................................................................................................772.9 Exercises .......................................................................................................................803. Programming a DATA Step ................................................................................................833.1 Writing Programs by Subdividing Tasks ................................................................83Estimate the Probability That a Randomly Selected 30- to 39-Year-OldMale Is Taller than a Randomly Selected Female of the Same Age .....................83Conditional Execution ...........................................................................................84Looping to Repeat a Task ......................................................................................86Returning to the Height Probability Simulation ............................................... 873.2 Ordering How Tasks Are Done ................................................................................90Missing Data in Functions .........................................................................................923.3 Indexable Lists of Variables (Also Known as Arrays) ...........................................93Defining Values in the Variable List .........................................................................93Inputting Values in the Variable List ........................................................................94Reassign Missing Value Codes for Numeric Variables “.” ...................................95Recoding Missing Values for All Numeric and Character Variables ..................953.4 Functions Associated with Statistical Distributions .............................................963.5 Generating Variables Using Random Number Generators ................................ 1023.6 Remembering Variable Values across Observations ........................................... 105Processing Multiple Observations for a Single Observation .............................. 1063.7 Case Study 1: Is the Two-Sample t-Test Robust to Violations of theHeterogeneous Variance Assumption? ................................................................. 109Case Study 1 (Revisited with DATA Step Programming) .................................. 1183.8 Efficiency Considerations—How Long Does It Take? .........................................1223.9 Case Study 2: Monte Carlo Integration to Estimate an Integral ........................ 1233.10 Case Study 3: Simple Percentile-Based Bootstrap ................................................ 1283.11 Case Study 4: Randomization Test for the Equality of Two Populations ......... 1303.12 Exercises ..................................................................................................................... 1344. Combining, Extracting, and Reshaping Data ............................................................... 1374.1 Adding Observations by SET-ing Data Sets.......................................................... 1374.2 Adding Variables by MERGE-ing Data Sets ......................................................... 1404.3 Working with Tables in PROC SQL ....................................................................... 1484.4 Converting Wide to Long Formats ......................................................................... 1614.5 Converting Long to Wide Formats ......................................................................... 1644.6 Case Study: Reshaping a World Bank Data Set .................................................... 1664.7 Building Training and Validation Data Sets ......................................................... 1754.8 Exercises ..................................................................................................................... 1794.9 Self-study Lab ............................................................................................................ 1805. Macro Programming .......................................................................................................... 1915.1 What Is a Macro and Why Would You Use It? ..................................................... 1915.2 Motivation for Macros: Numerical Integration to DetermineP(0 < Z < 1.645) ......................................................................................................... 1915.3 Processing Macros .................................................................................................... 1955.4 Macro Variables, Parameters, and Functions........................................................ 1955.5 Conditional Execution, Looping, and Macros ...................................................... 198More Complicated Macro Variable Construction ................................................203Changing Locations in a Macro during Execution ..............................................2045.6 Debugging Macro Code and Programs.................................................................206Write Out Values of Macro Variables .....................................................................206Useful SAS Options for Debugging Macros ......................................................... 2075.7 Saving Macros ........................................................................................................... 2115.8 Functions and Routines for Macros ....................................................................... 2115.9 Case Study: Macro for Constructing Training and Test Data Set for ModelComparison ............................................................................................................... 2165.10 Case Study: Processing Multiple Data Sets ...........................................................2235.11 Exercises .....................................................................................................................2276. Customizing Output and Generating Data Visualizations .......................................2296.1 Using the Output Delivery System ........................................................................229Basic Ideas ..................................................................................................................229Destinations—RTF, HTML, PDF, and More! .........................................................230What’s Produced and How to Select It ..................................................................235Another Destination That Stat Programmers Should Visit—OUTPUT ............ 2436.2 Graphics in SAS ......................................................................................................... 2496.3 ODS Statistical Graphics ..........................................................................................2506.4 Modifying Graphics Using the ODS Graphics Editor ......................................... 2576.5 Graphing with Styles and Templates .....................................................................2606.6 Statistical Graphics—Entering the Land of SG Procedures ............................... 266SGPLOT ...................................................................................................................... 266SGPANEL ................................................................................................................... 269SGSCATTER .............................................................................................................. 2716.7 Case Study: Using the SG Procedures ................................................................... 2736.8 Enhancing SG Displays—Options with SG Procedure Statements .................. 2796.9 Using Annotate Data Sets to Enhance SG Displays ............................................2846.10 Using Attribute Maps to Enhance SG Displays ................................................... 2876.11 Exercises .....................................................................................................................2907. Processing Text .................................................................................................................... 2937.1 Cleaning and Processing Text Data ....................................................................... 2937.2 Starting with Character Functions ......................................................................... 2937.3 Processing Text .......................................................................................................... 2987.4 Case Study: Sentiment in State of the Union Addresses .....................................3027.5 Case Study: Reading Text from a Web Page .........................................................3097.6 Regular Expressions ................................................................................................. 3157.7 Case Study (Revisited)—Applying Regular Expressions ................................... 3197.8 Exercises ..................................................................................................................... 3218. Programming with Matrices and Vectors ..................................................................... 3238.1 Defining a Matrix and Subscripting ...................................................................... 3238.2 Using Diagonal Matrices and Stacking Matrices ................................................. 3298.3 Using Elementwise Operations, Repeating, and Multiplying Matrices ........... 3328.4 Importing a Data Set into SAS/IML and Exporting Matrices fromSAS/IML to a Data Set .............................................................................................333Creating Matrices from SAS Data Sets and Vice Versa ........................................3338.5 Case Study 1: Monte Carlo Integration to Estimate π ..........................................3368.6 Case Study 2: Bisection Root Finder ...................................................................... 3378.7 Case Study 3: Randomization Test Using Matrices Imported from PROCPLAN ..........................................................................................................................3408.8 Case Study 4: SAS/IML Module to Implement Monte Carlo Integrationto Estimate π ..............................................................................................................3428.9 Storing and Loading SAS/IML Modules ..............................................................3448.10 SAS/IML and R .........................................................................................................3458.11 Exercises .....................................................................................................................350References ...................................................................................................................................355Index ............................................................................................................................................. 357
"This book is useful for people who want to learn SAS programing, and assumes the students have knowledge of multiple linear regression and one-way ANOVA models.…The second edition has added a chapter on text processing, and reorganized the chapter order…Some topics that are relevant for the SAS Base and Certifications exams are covered, and a nice feature is the highlighting of programing tips in gray." ~Technometrics"This is a very complete book for programming SAS in statistical analyses. This second edition offers the possibility to debug some programs and provides new examples and applications, which are very useful. This book is a very useful companion tool for students or beginners in SAS, or for more experienced statisticians who already use SAS for statistical analyses."~ISCB News