Example: quiz answers

Step-by-Step Programming with Base SAS Software

Step-by-Step Programming withBase SAS SoftwareThe correct bibliographic citation for this manual is as follows: SAS Institute Step-by-Step Programming with Base SAS Software . Cary, NC: SAS Institute Programming with Base SAS SoftwareCopyright 2001 by SAS Institute Inc., Cary, NC, 978-1-58025-791-6 All rights reserved. Produced in the United States of a hard-copy book:No part of this publication may be reproduced, stored in aretrieval system, or transmitted, in any form or by any means, electronic, mechanical,photocopying, or otherwise, without the prior written permission of the publisher, SASI nstitute a Web download or e-book:Your use of this publication shall be governed by theterms established by the vendor at the time you acquire this Government Restricted Rights , duplication, or disclosure of thissoftware and related documentation by the government is subject to the Agreementwith SAS Institute and the restrictions set forth in FAR Commercial ComputerSoftware-Restricted Rights (June 1987).

Oct 06, 1999 · Step-by-Step Programming with Base SAS® Software. Cary, NC: SAS Institute Inc. ... Input SAS Data Set for Examples 174 Working with Grouped Data 175 Working with Sorted Data 181 Review of SAS Tools 185 Learning More 186 ... Chapter 14 Working with Dates in the SAS System 211 Introduction to Working with Dates 211

Tags:

  Date, With, Software, Working, Sas software, 174 working, Working with dates

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Step-by-Step Programming with Base SAS Software

1 Step-by-Step Programming withBase SAS SoftwareThe correct bibliographic citation for this manual is as follows: SAS Institute Step-by-Step Programming with Base SAS Software . Cary, NC: SAS Institute Programming with Base SAS SoftwareCopyright 2001 by SAS Institute Inc., Cary, NC, 978-1-58025-791-6 All rights reserved. Produced in the United States of a hard-copy book:No part of this publication may be reproduced, stored in aretrieval system, or transmitted, in any form or by any means, electronic, mechanical,photocopying, or otherwise, without the prior written permission of the publisher, SASI nstitute a Web download or e-book:Your use of this publication shall be governed by theterms established by the vendor at the time you acquire this Government Restricted Rights , duplication, or disclosure of thissoftware and related documentation by the government is subject to the Agreementwith SAS Institute and the restrictions set forth in FAR Commercial ComputerSoftware-Restricted Rights (June 1987).

2 SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 2007 SAS Publishing provides a complete selection of books and electronic products to helpcustomers use SAS Software to its fullest potential. For more information about oure-books, e-learning products, CDs, and hard-copy books, visit the SAS Publishing Web call and all other SAS Institute Inc. product or service names are registered trademarksor trademarks of SAS Institute Inc. in the USA and other countries. indicates brand and product names are registered trademarks or trademarks of theirrespective to the SAS System 1 Chapter 1 What Is the SAS System? 3 Introduction to the SAS System3 Components of Base SAS Software4 Output Produced by the SAS System8 Ways to Run SAS Programs11 Running Programs in the SAS Windowing Environment13 Review of SAS Tools15 Learning More16 PART2 Getting Your Data into Shape 17 Chapter 2 Introduction to DATA Step Processing 19 Introduction to DATA Step Processing20 The SAS Data Set: Your Key to the SAS System20 How the DATA Step Works: A Basic Introduction26 Supplying Information to Create a SAS Data Set33 Review of SAS Tools41 Learning More41 Chapter 3 Starting with Raw Data: The Basics 43 Introduction to Raw Data44 Examine the Structure of the Raw Data.

3 Factors to Consider44 Reading Unaligned Data44 Reading Data That Is Aligned in Columns47 Reading Data That Requires Special Instructions50 Reading Unaligned Data with More Flexibility53 Mixing Styles of Input55 Review of SAS Tools58 Learning More59 Chapter 4 Starting with Raw Data: Beyond the Basics 61 Introduction to Beyond the Basics with Raw Data61 Testing a Condition before Creating an Observation62 Creating Multiple Observations from a Single Record63 Reading Multiple Records to Create a Single Observation67 Problem Solving: When an Input Record Unexpectedly Does Not Have EnoughValues74 Review of SAS Tools77 Learning More79ivChapter 5 Starting with SAS Data Sets 81 Introduction to Starting with SAS Data Sets81 Understanding the Basics82 Input SAS Data Set for Examples82 Reading Selected Observations84 Reading Selected Variables85 Creating More Than One Data Set in a Single DATA Step89 Using the DROP= and KEEP= Data Set Options for Efficiency91 Review of SAS Tools92 Learning More93 PART3 Basic Programming 95 Chapter 6 Understanding DATA Step Processing 97 Introduction to DATA Step Processing97 Input SAS Data Set for Examples97 Adding Information to a SAS Data Set98 Defining Enough Storage Space for Variables103 Conditionally Deleting an Observation104 Review of SAS Tools105 Learning More105 Chapter 7 working

4 with Numeric Variables 107 Introduction to working with Numeric Variables107 About Numeric Variables in SAS108 Input SAS Data Set for Examples108 Calculating with Numeric Variables109 Comparing Numeric Variables113 Storing Numeric Variables Efficiently115 Review of SAS Tools116 Learning More117 Chapter 8 working with Character Variables 119 Introduction to working with Character Variables119 Input SAS Data Set for Examples120 Identifying Character Variables and Expressing Character Values121 Setting the Length of Character Variables122 Handling Missing Values124 Creating New Character Values127 Saving Storage Space by Treating Numbers as Characters134 Review of SAS Tools135 Learning More136 Chapter 9 Acting on Selected Observations 139 Introduction to Acting on Selected Observations139 Input SAS Data Set for Examples140vSelecting Observations141 Constructing Conditions145 Comparing Characters152 Review of SAS Tools156 Learning More157 Chapter 10 Creating Subsets of Observations 159 Introduction to Creating Subsets of Observations159 Input SAS Data Set for Examples160 Selecting Observations for a New SAS Data Set161 Conditionally Writing Observations to One or More SAS Data Sets164 Review of SAS Tools170 Learning More170 Chapter 11 working with Grouped or Sorted Observations 173 Introduction to working with Grouped or Sorted Observations173 Input SAS Data Set for Examples174 working with Grouped Data175 working with Sorted Data181 Review of SAS Tools185 Learning More186 Chapter 12 Using More Than One Observation in a Calculation 187 Introduction to Using More Than One

5 Observation in a Calculation187 Input File and SAS Data Set for Examples188 Accumulating a Total for an Entire Data Set189 Obtaining a Total for Each BY Group191 Writing to Separate Data Sets193 Using a Value in a Later Observation196 Review of SAS Tools199 Learning More200 Chapter 13 Finding Shortcuts in Programming 201 Introduction to Shortcuts201 Input File and SAS Data Set201 Performing More Than One Action in an IF-THEN Statement202 Performing the Same Action for a Series of Variables204 Review of SAS Tools207 Learning More209 Chapter 14 working with Dates in the SAS System 211 Introduction to working with Dates211 Understanding How SAS Handles Dates212 Input File and SAS Data Set for Examples213 Entering Dates214 Displaying Dates217 Using Dates in Calculations221viUsing SAS date Functions223 Comparing Durations and SAS date Values225 Review of SAS Tools227 Learning More228 PART4 Combining SAS Data Sets 231 Chapter 15 Methods of Combining SAS Data Sets 233 Introduction to Combining SAS Data Sets233 Definition of Concatenating234 Definition of Interleaving234 Definition of Merging235 Definition of Updating236 Definition of Modifying237 Comparing Modifying, Merging.

6 And Updating Data Sets238 Learning More239 Chapter 16 Concatenating SAS Data Sets 241 Introduction to Concatenating SAS Data Sets241 Concatenating Data Sets with the SET Statement242 Concatenating Data Sets Using the APPEND Procedure255 Choosing between the SET Statement and the APPEND Procedure259 Review of SAS Tools260 Learning More260 Chapter 17 Interleaving SAS Data Sets 263 Introduction to Interleaving SAS Data Sets263 Understanding BY-Group Processing Concepts263 Interleaving Data Sets264 Review of SAS Tools267 Learning More267 Chapter 18 Merging SAS Data Sets 269 Introduction to Merging SAS Data Sets270 Understanding the MERGE Statement270 One-to-One Merging270 Match-Merging276 Choosing between One-to-One Merging and Match-Merging286 Review of SAS Tools290 Learning More290 Chapter 19 Updating SAS Data Sets 293 Introduction to Updating SAS Data Sets293 Understanding the UPDATE Statement294 Understanding How to Select BY Variables294 Updating a Data Set295viiUpdating with Incremental Values300 Understanding the Differences between Updating and Merging302 Handling Missing Values305 Review of SAS Tools308 Learning More309 Chapter 20 Modifying SAS Data Sets 311 Introduction311 Input SAS Data Set for Examples312 Modifying a SAS Data Set.

7 The Simplest Case313 Modifying a Master Data Set with Observations from a Transaction Data Set314 Understanding How Duplicate BY Variables Affect File Update317 Handling Missing Values319 Review of SAS Tools320 Learning More321 Chapter 21 Conditionally Processing Observations from Multiple SAS Data Sets 323 Introduction to Conditional Processing from Multiple SAS Data Sets323 Input SAS Data Sets for Examples324 Determining Which Data Set Contributed the Observation326 Combining Selected Observations from Multiple Data Sets328 Performing a Calculation Based on the Last Observation330 Review of SAS Tools332 Learning More332 PART5 Understanding Your SAS Session 333 Chapter 22 Analyzing Your SAS Session with the SAS Log 335 Introduction to Analyzing Your SAS Session with the SAS Log335 Understanding the SAS Log336 Locating the SAS Log337 Understanding the Log Structure337 Writing to the SAS Log339 Suppressing Information to the SAS Log341 Changing the Log s Appearance344 Review of SAS Tools346 Learning More346 Chapter 23 Directing SAS Output and the SAS Log 349 Introduction to Directing SAS Output and the SAS Log349 Input File and SAS Data Set for Examples350 Routing the Output and the SAS Log with PROC PRINTTO351 Storing the Output and the SAS Log in the SAS Windowing Environment353 Redefining the Default Destination in a Batch or Noninteractive Environment354 Review of SAS Tools355 Learning More356viiiChapter 24 Diagnosing and Avoiding Errors 357 Introduction to Diagnosing and Avoiding Errors357 Understanding How the SAS Supervisor Checks a Job357 Understanding How SAS

8 Processes Errors358 Distinguishing Types of Errors358 Diagnosing Errors359 Using a Quality Control Checklist366 Learning More366 PART6 Producing Reports 369 Chapter 25 Producing Detail Reports with the PRINT Procedure 371 Introduction to Producing Detail Reports with the PRINT Procedure372 Input File and SAS Data Sets for Examples372 Creating Simple Reports373 Creating Enhanced Reports381 Creating Customized Reports391 Making Your Reports Easy to Change399 Review of SAS Tools402 Learning More405 Chapter 26 Creating Summary Tables with the TABULATE Procedure 407 Introduction to Creating Summary Tables with the TABULATE Procedure408 Understanding Summary Table Design408 Understanding the Basics of the TABULATE Procedure410 Input File and SAS Data Set for Examples412 Creating Simple Summary Tables413 Creating More Sophisticated Summary Tables419 Review of SAS Tools431 Learning More433 Chapter 27 Creating Detail and Summary Reports with the REPORT Procedure 435 Introduction to Creating Detail and Summary Reports with the REPORTP rocedure436 Understanding How to Construct a Report436 Input File and SAS Data Set for Examples438 Creating Simple Reports439 Creating More Sophisticated Reports446 Review of SAS Tools454 Learning More458 PART7 Producing Plots and Charts 461 Chapter 28 Plotting the Relationship between Variables 463 Introduction to Plotting the Relationship between Variables463 Input File and SAS Data Set for Examples464ixPlotting One Set of Variables466 Enhancing the Plot468 Plotting Multiple Sets of Variables473 Review of SAS Tools480 Learning More481 Chapter 29

9 Producing Charts to Summarize Variables 483 Introduction to Producing Charts to Summarize Variables484 Understanding the Charting Tools484 Input File and SAS Data Set for Examples485 Charting Frequencies with the CHART Procedure487 Customizing Frequency Charts494 Creating High-Resolution Histograms503 Review of SAS Tools514 Learning More518 PART8 Designing Your Own Output 519 Chapter 30 Writing Lines to the SAS Log or to an Output File 521 Introduction to Writing Lines to the SAS Log or to an Output File521 Understanding the PUT Statement522 Writing Output without Creating a Data Set522 Writing Simple Text523 Writing a Report528 Review of SAS Tools535 Learning More536 Chapter 31 Understanding and Customizing SAS Output: The Basics 537 Introduction to the Basics of Understanding and Customizing SAS Output538 Understanding Output538 Input SAS Data Set for Examples540 Locating Procedure Output541 Making Output Informative542 Controlling Output Appearance548 Controlling the Appearance of Pages550 Representing Missing Values561 Review of SAS Tools563 Learning More564 Chapter 32 Understanding and Customizing SAS Output: The Output Delivery System(ODS)


Related search queries