SAS® Certification Prep Guide: Base Programming for SAS®9

Book description

Prepare for the SAS Base Programming for SAS®9 certification exam with the official guide by the SAS® Certified Professional Program. New and experienced SAS users who want to prepare for the SAS Base Programming for SAS®9 certification exam will find this guide an invaluable, convenient and comprehensive resource that covers all of the objectives tested on the exam. Major topics include importing and exporting raw data files, creating and modifying SAS data sets, and identifying and correcting data syntax and programming logic errors.You will also become familiar with the enhancements and new functionality that are available in SAS®9. Includes a free CD-ROM with tutorials, practice data, and sample programs to further reinforce and test your SAS skills.

Table of contents

  1. Copyright
  2. About This Book
    1. Purpose
    2. Audience
    3. Programming Environments
    4. How to Use This Book and CD-ROM
    5. Syntax Conventions for This Book
    6. Additional Resources
    7. SAS Certification Practice Exam: Base Programming for SAS9
    8. SAS Base Programming for SAS9
  3. 1. Basic Concepts
    1. Overview
      1. Introduction
      2. Objectives
    2. SAS Programs
      1. Components of SAS Programs
      2. Characteristics of SAS Programs
      3. Layout for SAS Programs
      4. Processing SAS Programs
      5. Log Messages
      6. Results of Processing
    3. SAS Libraries
      1. How SAS Files Are Stored
      2. Storing Files Temporarily or Permanently
    4. Referencing SAS Files
      1. Two-Level Names
      2. Referencing Temporary SAS Files
      3. Referencing Permanent SAS Files
      4. Rules for SAS Names
    5. SAS Data Sets
      1. Overview of Data Sets
      2. Descriptor Portion
      3. Data Portion
      4. Observations (Rows)
      5. Variables (Columns)
      6. Missing Values
    6. Variable Attributes
      1. Name
      2. Type
      3. Length
      4. Format
      5. Informat
      6. Label
    7. Summary
      1. Text Summary
        1. Components of SAS Programs
        2. Characteristics of SAS Programs
        3. Processing SAS Programs
        4. SAS Libraries
        5. Referencing SAS Files
        6. Overview of SAS Data Sets
        7. Variable Attributes
      2. Points to Remember
    8. Practice
    9. Quiz
  4. 2. Referencing Files and Setting Options
    1. Overview
      1. Introduction
      2. Objectives
    2. Referencing Files
      1. SAS Libraries
        1. Assigning Librefs
        2. Verifying Librefs
        3. How Long Librefs Remain in Effect
        4. Specifying Two-Level Names
      2. Other Formats
        1. Specifying Engines
        2. Interface Library Engines
        3. SAS/ACCESS Engines
    3. Viewing the Contents of SAS Libraries
      1. The CONTENTS Procedure
        1. Example
      2. The DATASETS Procedure
        1. Viewing Descriptor Information for a SAS Data Set
    4. Setting SAS System Options
      1. SAS Output
        1. Example: NUMBER | NONUMBER and DATE | NODATE Options
        2. Example: PAGENO= Option
        3. Example: PAGESIZE= Option
        4. Example: LINESIZE= Option
      2. Handling Two-Digit Year Values: Year 2000 Compliance
        1. How the YEARCUTOFF= Option Works
        2. How Four-Digit Year Values Are Handled
        3. Using System Options to Specify Observations
        4. Example: FIRSTOBS= and OBS= Options
        5. Using FIRSTOBS= and OBS= for Specific Data Sets
        6. Example: FIRSTOBS= and OBS as Data Set Options
    5. Viewing System Options
      1. The OPTIONS Procedure
        1. Example
    6. Additional System Options
    7. Summary
      1. Text Summary
        1. Referencing Files in SAS Libraries
        2. Viewing the Contents of SAS Libraries
        3. Setting SAS System Options
        4. Viewing SAS System Options
      2. Points to Remember
    8. Practice
    9. Quiz
  5. 3. Editing and Debugging SAS Programs
    1. Overview
      1. Introduction
      2. Objectives
    2. SAS Program Layout
    3. Interpreting Error Messages
      1. Error Types
      2. Syntax Errors
        1. Example
    4. Correcting Errors
      1. Resubmitting a Revised Program
    5. Resolving Common Problems
      1. Missing RUN Statement
        1. Resolving the Problem
      2. Missing Semicolon
        1. Resolving the Problem
      3. Unbalanced Quotation Marks
        1. Resolving the Problem
      4. Invalid Option
        1. Resolving the Problem
    6. Additional Features
      1. Comments in SAS Programs
      2. SAS System Options
    7. Summary
      1. Text Summary
        1. SAS Program Layout
        2. Interpreting Error Messages
        3. Correcting Errors
        4. Detecting and Resolving Common Problems
      2. Points to Remember
    8. Practice
    9. Quiz
  6. 4. Creating List Reports
    1. Overview
      1. Introduction
      2. Objectives
    2. Types of Reports
      1. Basic Report
      2. Column Totals
      3. Sorting and Labels
      4. Selected Observations and Variables
    3. Creating a Basic Report
      1. Selecting Observations
      2. Removing the OBS Column
    4. Identifying Observations
      1. Example
    5. Selecting Observations
      1. Specifying WHERE Expressions
      2. Using the CONTAINS Operator
      3. Specifying Compound WHERE Expressions
      4. Examples of WHERE Statements
    6. Sorting Data
      1. Example
    7. Generating Column Totals
      1. Requesting Subtotals
        1. Example
      2. Creating a Customized Layout with BY Groups and ID Variables
        1. Example
      3. Requesting Subtotals on Separate Pages
        1. Example
    8. Double-Spacing Listing Output
    9. Specifying Titles and Footnotes
      1. TITLE and FOOTNOTE Statements
        1. Examples: Titles
        2. Examples: Footnotes
      2. Modifying and Canceling Titles and Footnotes
    10. Assigning Descriptive Labels
      1. Temporarily Assigning Labels to Variables
        1. Example
        2. Using Single or Multiple LABEL Statements
    11. Formatting Data Values
      1. Temporarily Assigning Formats to Variables
      2. Specifying SAS Formats
        1. Field Widths
        2. Decimal Places
        3. Examples
    12. Using Permanently Assigned Labels and Formats
    13. Additional Features
    14. Summary
      1. Text Summary
        1. Creating a Basic Report
        2. Selecting Variables
        3. Selecting Observations
        4. Sorting Data
        5. Generating Column Totals
        6. Double-Spacing Output
        7. Specifying Titles
        8. Specifying Footnotes
        9. Assigning Descriptive Labels
        10. Formatting Data Values
        11. Using Permanently Assigned Labels and Formats
      2. Points to Remember
    15. Practice
    16. Quiz
  7. 5. Creating SAS Data Sets from Raw Data
    1. Overview
      1. Introduction
      2. Objectives
    2. Raw Data Files
    3. Steps to Create a SAS Data Set
    4. Referencing a SAS Library
      1. Using a LIBNAME Statement
    5. Referencing a Raw Data File
      1. Using a FILENAME Statement
        1. Defining a Fully Qualified Filename
        2. Defining an Aggregate Storage Location
      2. Referencing a Fully Qualified Filename
      3. Referencing a File in an Aggregate Storage Location
    6. Writing a DATA Step Program
      1. Naming the Data Set
      2. Specifying the Raw Data File
      3. Column Input
        1. Standard and Nonstandard Numeric Data
        2. Fixed-Field Data
      4. Describing the Data
        1. Specifying Variable Names
    7. Submitting the DATA Step Program
      1. Verifying the Data
      2. Checking DATA Step Processing
      3. Listing the Data Set
      4. Reading the Entire Raw Data File
      5. Invalid Data
    8. Creating and Modifying Variables
      1. SAS Expressions
      2. Using Operators in SAS Expressions
      3. More Examples of Assignment Statements
      4. Date Constants
        1. Example
    9. Subsetting Data
    10. Reading Instream Data
      1. Example
    11. Steps to Create a Raw Data File
      1. Using the_NULL_ Keyword
      2. Specifying the Raw Data File
      3. Describing the Data
    12. Additional Features
    13. Summary
      1. Text Summary
        1. Raw Data Files
        2. Steps to Create a SAS Data Set
        3. Referencing a SAS Library
        4. Referencing a Raw Data File
        5. Writing a DATA Step Program
        6. Submitting the DATA Step Program
        7. Creating and Modifying Variables
        8. Subsetting Data
        9. Reading Instream Data
        10. Creating a Raw Data File
      2. Points to Remember
    14. Practice
    15. Quiz
  8. 6. Understanding DATA Step Processing
    1. Overview
      1. Introduction
      2. Objectives
    2. Writing Basic DATA Steps
    3. How SAS Processes Programs
    4. Compilation Phase
      1. Input Buffer
      2. Program Data Vector
      3. Syntax Checking
      4. Data Set Variables
      5. Descriptor Portion of the SAS Data Set
      6. Summary of the Compilation Phase
    5. Execution Phase
      1. Example
      2. Initializing Variables
      3. Input Data
      4. Input Pointer
      5. End of the DATA Step
      6. Iterations of the DATA Step
      7. End-of-File Marker
      8. Summary of the Execution Phase
      9. End of the Execution Phase
    6. Debugging a DATA Step
      1. Diagnosing Errors in the Compilation Phase
      2. Diagnosing Errors in the Execution Phase
        1. Example
    7. Testing Your Programs
      1. Writing a NULL Data Set
      2. Limiting Observations
      3. PUT Statement
        1. Character Strings
        2. Data Set Variables
        3. Automatic Variables
        4. Conditional Processing
    8. Summary
      1. Text Summary
        1. How SAS Processes Programs
        2. Compilation Phase
        3. Execution Phase
        4. Diagnosing Errors in the Compilation Phase
        5. Diagnosing Errors in the Execution Phase
        6. Testing Your Programs
      2. Points to Remember
    9. Practice
    10. Quiz
  9. 7. Creating and Applying User-Defined Formats
    1. Overview
      1. Introduction
      2. Objectives
    2. Introduction to PROC FORMAT
    3. Invoking PROC FORMAT
      1. Permanently Storing Your Formats
    4. Defining a Unique Format
      1. Specifying Value Ranges
      2. Defining Multiple Formats
    5. Associating User-Defined Formats with Variables
      1. Referencing Your Formats
      2. Assigning Your Formats to Variables
      3. Displaying a List of Your Formats
    6. Summary
      1. Text Summary
        1. Invoking PROC FORMAT
        2. Defining a Unique Format
        3. Associating User-Defined Formats with Variables
      2. Points to Remember
    7. Practice
    8. Quiz
  10. 8. Creating Enhanced List and Summary Reports
    1. Overview
      1. Introduction
      2. Objectives
    2. Creating a Default List Report
      1. Example
    3. Selecting Variables
      1. Example
    4. Selecting Observations
      1. Example
    5. Defining Variables
      1. Overview of Defining Variables
      2. Using DEFINE Statements
        1. Example
    6. Defining Column Attributes
      1. Assigning Formats
        1. Example
      2. Specifying Column Widths
        1. Example
      3. Specifying Column Spacing
        1. Example
    7. Defining Column Headings
      1. Example
      2. Splitting Column Headings across Multiple Lines
        1. Example
    8. Specifying Column Justification
      1. Example
    9. Enhancing the Heading’s Appearance
      1. Example
    10. Defining Variable Usage
      1. How PROC REPORT Uses Variables
      2. Using Order Variables
      3. Using Group Variables
        1. Example
      4. Revising the Report
      5. Specifying Statistics
      6. Using Across Variables
        1. Example
      7. Using Computed Variables
        1. Example
    11. Summary
      1. Text Summary
        1. Creating a Default List Report
        2. Selecting Variables
        3. Selecting Observations
        4. Defining Variables
        5. Defining Column Attributes
        6. Enhancing the Heading’s Appearance
        7. Defining Variable Usage
        8. Specifying Statistics
      2. Points to Remember
    12. Practice
    13. Quiz
  11. 9. Producing Descriptive Statistics
    1. Overview
      1. Introduction
      2. Objectives
    2. Computing Statistics for Numeric Variables
      1. Computing Statistics Using PROC MEANS
      2. Specifying Statistics
      3. Limiting Decimal Places
      4. Specifying Variables in PROC MEANS
      5. Group Processing Using the CLASS Statement
      6. Group Processing Using the BY Statement
      7. Creating a Summarized Data Set Using PROC MEANS
        1. Specifying the statistic-keyword= Option
      8. Creating a Summarized Data Set Using PROC SUMMARY
        1. Example
    3. Producing Frequency Tables
      1. Producing Frequency Tables Using PROC FREQ
      2. Specifying Variables in PROC FREQ
        1. Example
      3. Creating Two-Way Tables
      4. Creating N-Way Tables
        1. Determining the Table Layout
      5. Changing the Table Format
      6. Creating Tables in List Formats
        1. Example
      7. Suppressing Table Information
        1. Example
    4. Summary
      1. Text Summary
        1. Purpose of PROC MEANS
        2. Specifying Statistics
        3. Limiting Decimal Places
        4. Specifying Variables in PROC MEANS
        5. Group Processing Using the CLASS Statement
        6. Group Processing Using the BY Statement
        7. Creating a Summarized Data Set Using PROC MEANS
        8. Creating a Summarized Data Set Using PROC SUMMARY
        9. The FREQ Procedure
        10. Specifying Variables
        11. Creating Two-Way Tables
        12. Creating N-Way Tables
        13. Creating Tables in List Format
        14. Suppressing Table Information
      2. Points to Remember
    5. Practice
    6. Quiz
  12. 10. Producing HTML Output
    1. Overview
      1. Introduction
      2. Objectives
    2. The Output Delivery System
      1. Advantages of ODS
      2. How ODS Works
    3. Opening and Closing ODS Destinations
      1. ODS Destinations
      2. Using Statements to Open and Close ODS Destinations
        1. Example
      3. Closing the Listing Destination
        1. Example
      4. Closing Multiple ODS Destinations Concurrently
        1. Example
    4. Creating Simple HTML
      1. Example
        1. Viewing Your HTML Output
      2. Creating HTML Output from Multiple Procedures
    5. Creating HTML Output with a Table of Contents
      1. Example
        1. Viewing Frame Files
      2. Using the Table of Contents
    6. Using Options to Specify Links and Paths
      1. The URL= Suboption
        1. Example: Relative URLs
        2. Example: Absolute URLs
      2. The PATH= Option
        1. Example: PATH= Option with URL=NONE
        2. Example: PATH= Option without the URL= Suboption
        3. Example: PATH= Option with a Specified URL
    7. Changing the Appearance of HTML Output
      1. The STYLE= Option
        1. Example
    8. Additional Features
      1. Customizing HTML Output
    9. Summary
      1. Text Summary
        1. The OUTPUT Delivery System
        2. Opening and Closing ODS Destinations
        3. Creating Simple HTML Output
        4. Creating HTML Output with a Table of Contents
        5. Using Options to Specify Links and Paths
        6. Changing the Appearance of HTML Output
        7. Additional Features
      2. Points to Remember
    10. Practice
    11. Quiz
  13. 11. Creating and Managing Variables
    1. Overview
      1. Introduction
      2. Objectives
    2. Creating and Modifying Variables
      1. Accumulating Totals
        1. Example
      2. Initializing Accumulator Variables
        1. Example
    3. Assigning Values Conditionally
      1. Example
      2. Comparison and Logical Operators
        1. Examples
      3. Providing an Alternative Action
    4. Specifying Lengths for Variables
      1. Examples
    5. Subsetting Data
      1. Deleting Unwanted Observations
        1. Example
      2. Selecting Variables with the DROP= and KEEP= Data Set Options
        1. Example
        2. Example
    6. Assigning Permanent Labels and Formats
      1. Example
    7. Assigning Values Conditionally Using SELECT Groups
      1. Example
      2. Example: SELECT Group in a DATA Step
      3. Specifying SELECT Statements with Expressions
      4. Specifying SELECT Statements without Expressions
    8. Grouping Statements Using DO Groups
      1. Examples
      2. Indenting and Nesting DO Groups
    9. Summary
      1. Text Summary
        1. Accumulating Totals
        2. Initializing Accumulator Variables
        3. Assigning Values Conditionally
        4. Specifying Lengths for Variables
        5. Subsetting Data
        6. Assigning Permanent Labels and Formats
        7. Assigning Values Conditionally Using SELECT Groups
        8. Grouping Statements Using DO Groups
      2. Points to Remember
    10. Practice
    11. Quiz
  14. 12. Reading SAS Data Sets
    1. Overview
      1. Introduction
      2. Objectives
    2. Reading a Single Data Set
    3. Manipulating Data
      1. Example
      2. Where to Specify the DROP= and KEEP= Data Set Options
    4. Using BY-Group Processing
      1. Finding the First and Last Observations in a Group
        1. Example
      2. Finding the First and Last Observations in Subgroups
        1. Example
    5. Reading Observations Using Direct Access
      1. The POINT= Option
        1. Example
      2. Preventing Continuous Looping with the POINT= Option
      3. Writing Observations Explicitly
      4. More Complex Ways of Using Direct Access
    6. Detecting the End of a Data Set
      1. The END= Option
        1. Examples
    7. Understanding How Data Sets Are Read
      1. Compilation Phase
      2. Execution Phase
    8. Additional Features
    9. Summary
      1. Text Summary
        1. Setting Up
        2. Reading a Single Data Set
        3. Selecting Variables
        4. BY-Group Processing
        5. Reading Observations Using Direct Access
        6. Detecting the End of a Data Set
      2. Points to Remember
    10. Practice
    11. Quiz
  15. 13. Combining SAS Data Sets
    1. Overview
      1. Introduction
      2. Objectives
    2. One-to-One Reading
      1. How One-to-One Reading Selects Data
      2. How One-to-One Reading Works
        1. Example
    3. Concatenating
      1. How Concatenating Selects Data
        1. Example
    4. Interleaving
      1. How Interleaving Selects Data
        1. Example
    5. Simple Match-Merging
      1. How Match-Merging Selects Data
        1. Example: Merging Data Sets That Are Sorted in Ascending Order
        2. Example: Sorting and Merging Data Sets in Descending Order
    6. Match-Merge Processing
      1. Introduction
      2. The Compilation Phase: Setting Up the New Data Set
      3. The Execution Phase: Match-Merging Observations
      4. Handling Unmatched Observations and Missing Values
      5. Summary of Match-Merge Processing
    7. Renaming Variables
    8. Excluding Unmatched Observations
      1. Creating Temporary IN= Variables
      2. Selecting Matching Observations
    9. Selecting Variables
      1. Where to Specify the DROP= and KEEP= Options
    10. Additional Features
    11. Summary
      1. Text Summary
        1. One-to-One Reading
        2. Concatenating
        3. Interleaving
        4. Simple Match-Merging
        5. Match-Merge Processing
        6. Compiling
        7. Executing
        8. Handling Unmatched Observations and Missing Values
        9. Renaming Variables
        10. Excluding Unmatched Observations
        11. Selecting Variables
      2. Points to Remember
    12. Practice
    13. Quiz
  16. 14. Transforming Data with SAS Functions
    1. Overview
      1. Introduction
      2. Objectives
    2. Understanding SAS Functions
      1. Uses of SAS Functions
      2. Example of a SAS Function
    3. General Form of SAS Functions
      1. Arguments, Variable Lists, Arrays
        1. Example
      2. Target Variables
    4. Converting Data with Functions
      1. Introduction to Converting Data
      2. Potential Problems of Omitting INPUT or PUT
      3. Automatic Character-to-Numeric Conversion
      4. When Automatic Conversion Occurs
      5. Restriction for WHERE Expressions
      6. Explicit Character-to-Numeric Conversion
      7. Automatic Numeric-to-Character Conversion
      8. Explicit Numeric-to-Character Conversion
        1. Matching the Data Type
    5. Manipulating SAS Date Values with Functions
      1. SAS Date and Time Values
      2. SAS Date Functions
      3. YEAR, QTR, MONTH, and DAY Functions
        1. Finding the Year
        2. Finding the Year and Month
      4. WEEKDAY Function
      5. MDY Function
      6. DATE and TODAY Functions
      7. INTCK Function
        1. Example: The INTCK Function
      8. INTNX Function
      9. DATDIF and YRDIF Functions
    6. Modifying Character Values with Functions
      1. Introduction to Modifying Character Values
      2. SCAN Function
        1. Specifying Delimiters
        2. Specifying Multiple Delimiters
        3. Default Delimiters
        4. SYNTAX
        5. Specifying Variable Length
      3. SUBSTR Function
        1. Positioning the SUBSTR Function
        2. Replacing Text
      4. SCAN Function Compared with SUBSTR Function
      5. TRIM Function
        1. Points to Remember
      6. CATX Function
      7. INDEX Function
        1. Finding a String Regardless of Case
      8. FIND Function
        1. Example
      9. UPCASE Function
      10. LOWCASE Function
      11. PROPCASE Function
      12. TRANWRD Function
    7. Modifying Numeric Values with Functions
      1. Introduction
      2. INT Function
      3. ROUND Function
    8. Nesting SAS Functions
    9. Summary
      1. Text Summary
        1. Using SAS Functions
        2. Automatic Character-to-Numeric Conversion
        3. Explicit Character-to-Numeric Conversion
        4. Automatic Numeric-to-Character Conversion
        5. Explicit Numeric-to-Character Conversion
        6. SAS Date and Time Values
        7. YEAR, QTR, MONTH, and DAY Functions
        8. WEEKDAY Function
        9. MDY Function
        10. DATE and TODAY Functions
        11. INTCK Function
        12. INTNX Function
        13. DATDIF and YRDIF Functions
        14. SCAN Function
        15. SUBSTR Function
        16. SCAN Function versus SUBSTR Function
        17. TRIM Function
        18. CATX Function
        19. INDEX Function
        20. FIND Function
        21. UPCASE Function
        22. LOWCASE Function
        23. PROPCASE Function
        24. TRANWRD Function
        25. INT Function
        26. ROUND Function
        27. Nesting SAS Functions
      2. Points to Remember
    10. Practice
    11. Quiz
  17. 15. Generating Data with DO Loops
    1. Overview
      1. Introduction
      2. Objectives
    2. Constructing DO Loops
      1. Introduction
      2. General Form of DO Loops
      3. DO Loop Execution
      4. Counting Iterations of DO Loops
        1. Explicit OUTPUT Statements
      5. Decrementing DO Loops
        1. Specifying a Series of Items
    3. Nesting DO Loops
    4. Iteratively Processing Data That Is Read from a Data Set
    5. Conditionally Executing DO Loops
      1. Using the DO UNTIL Statement
      2. Using the DO WHILE Statement
    6. Using Conditional Clauses with the Iterative DO Statement
    7. Creating Samples
    8. Summary
      1. Text Summary
        1. Purpose of DO Loops
        2. Syntax of Iterative DO Loops
        3. DO Loop Execution
        4. Counting DO Loop Iterations
        5. Decrementing DO Loops
        6. Specifying a Series of Items
        7. Nesting DO Loops
        8. Iteratively Processing Data That Is Read from a Data Set
        9. Conditionally Executing DO Loops
        10. Using Conditional Clauses within Iterative DO Statements
        11. Creating Samples
      2. Points to Remember
    9. Practice
    10. Quiz
  18. 16. Processing Variables with Arrays
    1. Overview
      1. Introduction
      2. Objectives
    2. Creating One-Dimensional Arrays
      1. Understanding SAS Arrays
      2. General Form of an Array
        1. Specifying the Array Name
        2. Specifying the Dimension
        3. Specifying Array Elements
      3. Variable Lists as Array Elements
        1. Specifying a Numbered Range of Variables
        2. Specifying All Numeric Variables
        3. Specifying All Character Variables
        4. Specifying All Variables
      4. Referencing Elements of an Array
      5. Compilation and Execution
      6. Using the DIM Function in an Iterative DO Statement
    3. Expanding Your Use of Arrays
      1. Creating Variables in an ARRAY Statement
        1. Creating Default Variable Names
        2. Creating Arrays of Character Variables
        3. Using an ARRAY Statement with an Iterative DO Statement
      2. Assigning Initial Values to Arrays
      3. Creating Temporary Array Elements
      4. Understanding Multidimensional Arrays
      5. Defining a Multidimensional Array
      6. Example: Referencing Elements of a Two-Dimensional Array
    4. Additional Features
    5. Summary
      1. Text Summary
        1. Purpose of SAS Arrays
        2. Defining an Array
        3. Variable Lists as Array Elements
        4. Referencing Elements of an Array
        5. The DIM Function
        6. Creating Variables with the ARRAY Statement
        7. Assigning Initial Values to Arrays
        8. Creating Temporary Array Elements
        9. Multidimensional Arrays
        10. Referencing Elements of a Two-Dimensional Array
        11. Rotating Data Sets
      2. Points to Remember
    6. Practice
    7. Quiz
  19. 17. Reading Raw Data in Fixed Fields
    1. Overview
      1. Introduction
      2. Objectives
    2. Review of Column Input
      1. Introduction
      2. Column Input Features
    3. Identifying Standard and Nonstandard Numeric Data
      1. Standard Numeric Data
      2. Nonstandard Numeric Data
    4. Choosing an Input Style
    5. Using Formatted Input
      1. General Form of the INPUT Statement Using Formatted Input
      2. Using the @n Column Pointer Control
      3. Reading Columns in Any Order
      4. The +n Pointer Control
    6. Using Informats
      1. Reading Character Values
      2. Reading Standard Numeric Data
      3. Reading Nonstandard Numeric Data
      4. DATA Step Processing of Informats
    7. Record Formats
      1. Fixed-Length Records
      2. Variable-Length Records
        1. Reading Variable-Length Records
        2. The PAD Option
    8. Summary
      1. Text Summary
        1. Review of Column Input
        2. Identifying Nonstandard Numeric Data
        3. Choosing an Input Style
        4. Using Formatted Input
        5. Using Informats
        6. Record Formats
      2. Points to Remember
    9. Practice
    10. Quiz
  20. 18. Reading Free-Format Data
    1. Overview
      1. Introduction
      2. Objectives
    2. Reading Free-Format Data
    3. Using List Input
      1. Processing List Input
      2. Working with Delimiters
        1. Example
      3. Reading a Range of Variables
      4. Limitations of List Input
    4. Reading Missing Values
      1. Reading Missing Values at the End of a Record
      2. Reading Missing Values at the Beginning or Middle of a Record
        1. The DSD Option
        2. The DLM= Option
    5. Specifying the Length of Character Values
      1. The LENGTH Statement
    6. Modifying List Input
      1. Reading Values That Contain Embedded Blanks
        1. Using the Ampersand (&) Modifier with a LENGTH Statement
        2. Using the Ampersand (&) Modifier with an Informat
      2. Reading Nonstandard Values
      3. Processing the DATA Step
      4. Comparing Formatted Input and Modified List Input
    7. Creating Free-Format Data
      1. Specifying a Delimiter
      2. Using the DSD Option
      3. Reading Values That Contain Delimiters within a Quoted String
    8. Mixing Input Styles
      1. Additional Features
        1. Writing Character Strings and Variable Values
    9. Summary
      1. Text Summary
        1. Free-Format Data
        2. Using List Input
        3. Reading Missing Values
        4. Specifying the Length of Character Values
        5. Modifying List Input
        6. Creating Free-Format Data
        7. Mixing Input Styles
      2. Points to Remember
    10. Practice
    11. Quiz
  21. 19. Reading Date and Time Values
    1. Overview
      1. Introduction
      2. Objectives
    2. How SAS Stores Date Values
    3. How SAS Stores Time Values
    4. More about SAS Date and Time Values
    5. Reading Date and Time Informats
      1. Specifying Informats
      2. MMDDYYw. Informat
      3. DATEw. Informat
      4. TIMEw. Informat
      5. DATETIMEw. Informat
      6. YEARCUTOFF= SAS System Option
    6. Using Dates and Times in Calculations
      1. Introduction
        1. Example
    7. Using Date and Time Formats
      1. The WEEKDATEw. Format
      2. The WORDDATEw. Format
    8. Summary
      1. Text Summary
        1. How SAS Stores Date and Time Values
        2. Reading Dates and Times with Informats
        3. Using Dates and Times in Calculations
        4. Using Date and Time Formats
      2. Points to Remember
    9. Practice
    10. Quiz
  22. 20. Creating a Single Observation from Multiple Records
    1. Overview
      1. Introduction
      2. Objectives
    2. Use Line Pointer Controls
    3. Reading Multiple Records Sequentially
      1. The Forward Slash (/) Line Pointer Control
      2. Sequential Processing of Multiple Records in the DATA Step
      3. Number of Records Per Observation
    4. Reading Multiple Records Non-Sequentially
      1. The #n Line Pointer Control
        1. Example: Using the #n Line Pointer Control
      2. Execution of the DATA Step
    5. Combining Line Pointer Controls
    6. Summary
      1. Text Summary
        1. Multiple Records Per Observation
        2. Reading Multiple Records Sequentially
        3. Reading Multiple Records Non-Sequentially
        4. Combining Line Pointer Controls
      2. Points to Remember
    7. Practice
    8. Quiz
  23. 21. Creating Multiple Observations from a Single Record
    1. Overview
      1. Introduction
      2. Objectives
    2. Reading Repeating Blocks of Data
      1. Holding the Current Record with a Line-Hold Specifier
      2. Using the Double Trailing At Sign (@) to Hold the Current Record
      3. Completing the DATA Step
      4. DATA Step Processing of Repeating Blocks of Data
        1. Example
    3. Reading the Same Number of Repeating Fields
      1. Using the Single Trailing At Sign (@) to Hold the Current Record
      2. More Efficient Programming
      3. Processing a DATA Step That Contains an Iterative DO Loop
    4. Reading a Varying Number of Repeating Fields
      1. Using the MISSOVER Option
      2. Executing SAS Statements While a Condition Is True
      3. Creating a Counter Variable
      4. Completing the DO WHILE Loop
      5. Processing a DATA Step That Has a Varying Number of Repeating Fields
    5. Summary
      1. Text Summary
        1. File Formats
        2. Reading Repeating Blocks of Data
        3. Reading the Same Number of Repeating Fields
        4. Reading a Varying Number of Repeating Fields
      2. Points to Remember
    6. Practice
    7. Quiz
  24. 22. Reading Hierarchical Files
    1. Overview
      1. Introduction
      2. Objectives
    2. Creating One Observation Per Detail Record
      1. Retaining the Values of Variables
      2. Conditionally Executing SAS Statements
      3. Reading a Detail Record
      4. Dropping Variables
      5. Processing a DATA Step That Creates One Observation Per Detail Record
      6. Printing Your Results
    3. Creating One Observation Per Header Record
      1. DO Group Actions for Header Records
      2. Reading Detail Records
      3. Determining the End of the External File
      4. Processing a DATA Step That Creates One Observation Per Header Record
    4. Summary
      1. Text Summary
        1. Hierarchical Raw Data Files
        2. Creating One Observation Per Detail Record
        3. Creating One Observation Per Header Record
      2. Points to Remember
    5. Practice
    6. Quiz
  25. Quiz Answer Keys
    1. Chapter 1: Basic Concepts Answer Key
    2. Chapter 2: Referencing Files and Setting Options Answer Key
    3. Chapter 3: Editing and Debugging SAS Programs Answer Key
    4. Chapter 4: Creating List Reports Answer Key
    5. Chapter 5: Creating SAS Data Sets from Raw Data Answer Key
    6. Chapter 6: Understanding DATA Step Processing Answer Key
    7. Chapter 7: Creating and Applying User-Defined Formats Answer Key
    8. Chapter 8: Creating Enhanced List and Summary Reports Answer Key
    9. Chapter 9: Producing Descriptive Statistics Answer Key
    10. Chapter 10: Producing HTML Output Answer Key
    11. Chapter 11: Creating and Managing Variables Answer Key
    12. Chapter 12: Reading SAS Data Sets Answer Key
    13. Chapter 13: Combining SAS Data Sets Answer Key
    14. Chapter 14: Transforming Data with SAS Functions Answer Key
    15. Chapter 15: Generating Data with DO Loops Answer Key
    16. Chapter 16: Processing Variables with Arrays Answer Key
    17. Chapter 17: Reading Raw Data in Fixed Fields Answer Key
    18. Chapter 18: Reading Free-Format Data Answer Key
    19. Chapter 19: Reading Date and Time Values Answer Key
    20. Chapter 20: Creating a Single Observation from Multiple Records Answer Key
    21. Chapter 21: Creating Multiple Observations from a Single Record Answer Key
    22. Chapter 22: Reading Hierarchical Files Answer Key
  26. Glossary

Product information

  • Title: SAS® Certification Prep Guide: Base Programming for SAS®9
  • Author(s):
  • Release date: March 2006
  • Publisher(s): SAS Institute
  • ISBN: 9781590479223