You are previewing SAS Hash Object Programming Made Easy.
O'Reilly logo
SAS Hash Object Programming Made Easy

Book Description

Hash objects, an efficient look-up tool in the SAS DATA step, are object-oriented programming structures that function differently from traditional SAS language statements. Michele Burlew's SAS Hash Object Programming Made Easy shows readers how to use these powerful features, which they can program to quickly look up and manage data and to conserve computing resources. SAS provides various look-up techniques, and hash objects are among the newest, so therefore many users may not have yet used them. Because the examples presented vary in complexity, SAS Hash Object Programming Made Easy is useful to SAS users of all experience levels, from novice programmer to advanced programmer. Novice programmers can adapt some of the simpler hash programming techniques as they develop their SAS programming skills. This book helps more experienced programmers learn how to take advantage of hash object programming by comparing traditional processing techniques to those that use hash objects. Additionally, users from diverse fields with different requirements can adapt the examples in SAS Hash Object Programming Made Easy to fit their unique situations.

Table of Contents

  1. Cover
  2. Title Page
  3. Copyright Page
  4. Contents
  5. About This Book
  6. About The Author
  7. Acknowledgments
  8. Preface
  9. Chapter 1: An Overview of Hash Objects
    1. What Are Hash Objects?
    2. Introducing a Simple Hash Object Application
  10. Chapter 2: Hash Object Terminology and Concepts
    1. What Is a SAS Hash Object?
    2. Defining Terms Associated with Hash Objects
    3. Writing Code That Works with Hash Objects
    4. Understanding How SAS Stores Hash Objects in Memory
    5. Understanding How Long Hash Objects Persist
    6. Specifying the Contents of Hash Objects
    7. Initializing Variables in a DATA Step That Contains a Hash Object
    8. Illustrating How the Program Data Vector Connects DATA Step Variables and Hash Object Items
  11. Chapter 3: Basic Hash Object Applications
    1. Using a Hash Object As a Lookup Table
    2. Defining a Hash Object
    3. Finding Key Values in a Hash Object
    4. Defining the Key Structure in a Hash Object
    5. Understanding How the FIND and CHECK Methods Alter the Values of DATA Step Variables and Hash Object Data Items
    6. Application Example: Verifying Presence of Key Values
    7. Application Example: Returning Data Items from a Hash Object
    8. Application Example: Defining the Key Value During Processing of the DATA Step
    9. Application Example: Searching for a Key Value in Multiple Hash Objects
    10. Application Example: Combining Data from Multiple Sources
    11. Using Multiple Key Items to Look Up Data
    12. Traversing Hash Objects
    13. Specifying a Hash Iterator Object
    14. Understanding the Methods That Control Traversal of a Hash Object
    15. Illustrating How the Hash Iterator Object Traverses a Hash Object
    16. Application Example: Traversing a Hash Object from Beginning to End
    17. Application Example: Linking Hierarchically Related Data Sets
    18. Application Example: Performing a Fuzzy Merge Using a Hash Iterator Object
  12. Chapter 4: Creating Data Sets from Hash Objects and Updating Contents of Hash Objects
    1. Creating a Data Set from a Hash Object
    2. Adding, Modifying, and Removing Data from a Hash Object
    3. Defining the Key Structure in a Hash Object
    4. Understanding How to Specify the KEY and DATA Argument Tags
    5. Identifying the Variables That the OUTPUT Method Writes to a Data Set
    6. Understanding the Interaction between DATA Step Variables and Hash Object Data Items When Replacing Data in a Hash Object
    7. Replacing Key Item Values When a Key Item Is Also a Data Item
    8. Comparing the DATA Statement and the OUTPUT Method
    9. Application Example: Finding the Unique Values of a Variable in a Data Set
    10. Application Example: Ordering Observations by Variables Not Saved to a Data Set Created from a Hash Object
    11. Application Example: Using Hash Objects to Apply Transactions to Master Data Sets—Part 1
    12. Application Example: Using Hash Objects to Apply Transactions to Master Data Sets—Part 2
    13. Application Example: Summarizing Data with the Hash Iterator Object
    14. Application Example: Summarizing Hierarchically Related Data
  13. Chapter 5: Hash Objects with Multiple Sets of Data Items per Key Value
    1. Understanding the Concepts of Duplicate Key Values and Multiple Sets of Data Items per Key Value in a Hash Object
    2. Defining Hash Objects That Process Multiple Sets of Data Items per Key Value
    3. Illustrating How the MULTIDATA and DUPLICATE Argument Tags Affect Hash Object Processing
    4. Understanding the Methods That Look for Multiple Sets of Data Items per Key
    5. Understanding How SAS Stores Multiple Sets of Data Items per Key
    6. Comparing Retrieval of Data from a Hash Object That Allows Multiple Sets of Data Items per Key Value to a Hash Iterator Object
    7. Modifying Data in a Hash Object That Allows Multiple Sets of Data Items per Key Value
    8. Summarizing Data in Hash Objects That Allow Multiple Sets of Data Items per Key Value
    9. Application Example: Summarizing and Sorting a Data Set
    10. Application Example: Creating Data Sets Based on a Series of Observations
    11. Application Example: Creating a Data Set That Contains All Combinations of Specific Variables When the Number of Combinations Is Large
    12. Application Example: Linking Hierarchically Related Data Using a Hash Object That Allows Multiple Sets of Data Items per Key Value
  14. Chapter 6: Managing Hash Objects
    1. Creating, Deleting, and Clearing Hash Objects During Execution of a DATA Step
    2. Determining the Number of Items in a Hash Object
    3. Application Example: Creating a Data Set for Each BY Group
    4. Comparing Two Hash Objects
    5. Specifying Memory Structure Usage of a Hash Object
    6. Determining the Size of an Entry in a Hash Object
  15. References
  16. Index