Advanced Base SAS Programming Techniques
Presented: Tuesday September 4, 2018, 8:00am-5:00pm
Presented by:
Kirk Paul Lafler is an entrepreneur, consultant, and founder at Software Intelligence Corporation, and has been using SAS since 1979. Kirk is a SAS application developer, programmer, Certified Professional, provider of SAS consulting and training services, mentor, advisor and adjunct professor at University of California San Diego Extension, emeritus sasCommunity.org Advisory Board member, and educator to SAS users around the world. As the author of six books including Google® Search Complete (Odyssey Press, 2014) and PROC SQL: Beyond the Basics Using SAS, Second Edition (SAS Press, 2013); Kirk has written hundreds of papers and articles; served as an invited speaker, trainer, keynote and section leader at international, regional, special-interest, local, and in-house SAS user group conferences and meetings; and is the recipient of 25 Best Contributed Paper awards.
Description:
Data-driven programming, or data-oriented programming (DOP), is a popular programming paradigm where the data, or data structures, control the flow of a program and not the program logic. It is also applied to structured and unstructured data for filtering, aggregating, transforming and calling other programs. Topics include the various SAS® programming techniques to access NLEVELS (BY-group content); the creation of single-value and value-list macro variables; the application of iterative programming constructs and processes to dynamically create data-driven programs; construct an external control file to define relationships; use PROC FORMAT with CNTLIN= option; access SAS dictionary tables (or SASHELP Views) content; use the FETCHOB() function; use CALL SYMPUTX; use CALL EXECUTE; use PROC FCMP with RUN_MACRO; use the DOSUBL function; and a variety of programming examples to discover valuable information about the assigned librefs and filerefs, the names of the tables available in for libref, determine if a data set is empty, identify the number of observations in any data set, determine the number of character versus numeric variables in any data set, identify and assess variable attributes, determine the names of variables associated with simple and composite indexes, and access the content of read-only SAS metadata DICTIONARY tables and SASHELP views.
Intended Audience: All levels
Tools Discussed: Base SAS
Prerequisite: None
Class Outline:
- Data Access Techniques
- Access Multi-platform Data
- Reading CSV Data
- Standard Data
- Non-Standard Data
- Specifying an INFORMAT Statement
- Concatenating External Data Files
- Reading Data with the Trailing @
- Reading Hierarchical-structured Data
- Reading “Free Format” Data
- Using the SASFILE Statement
- Restructuring Data with PROC TRANSPOSE
- TRANSPOSE Overview
- Types of Transposes
- Transposing Numeric Variables
- Transposing with a Grouping Variable
- DATA Step Programming Techniques
- SAS Arrays
- Why Use Arrays?
- How Arrays Work
- Types of Arrays
- Using Arrays
- User-defined Formats
- Custom Numeric User-defined Formats
- Custom Character User-defined Formats
- Custom User-defined Formats based on another User-defined Format
- Saving a User-defined Format as a SAS Data Set
- Operators and Functions
- Using the LIKE Operator with Percent Sign
- Using the INDEX Function
- Using the Family of CAT Functions
- Fuzzy Matching
- What Happens when the Keys between Data Sets are Unreliable
- Fuzzy Matching Questions
- Steps to Successful Fuzzy Matching
- Fuzzy Matching Side-by-side Comparison
- Using the SOUNDEX Algorithm
- Using the SPEDIS Function
- Using the COMPLEV Function
- Using the COMPGED Function
- DATA Step Hash Objects
- Features
- How Does a Hash Object Work?
- General Hash Object Syntax
- Hash Object Methods
- Hash Merge Example
- Hash Sort Example
- Data-driven Programming
- Features
- Benefits of Data-driven Programming
- Traditional Programming versus Data-driven Programming
- Developing a Data-driven Program
- Steps to Creating a Data-driven Program
- Using Macro Variables
- Using Programming Constructs
- Applications of Data-driven Programming – Examples
- Count Distinct Values (or Levels) with the INTO-clause
- Capture a List of Distinct Values with the INTO-clause and SEPARATED BY (Value-list Macro Variable)
- External Control File to Define Relationships
- PROC FORMAT with CNTLIN=
- Use SAS Dictionary Tables (or SASHELP Views)
- FETCHOB() Function
- CALL SYMPUTX
- CALL EXECUTE
- PROC FCMP with RUN_MACRO
- DOSUBL Function
- Simple and Composite Indexes
- Types of Indexes
- Benefits of Indexes
- Anatomy of an Index
- Index Entries and Pointers
- Rules – Evaluating Index Usage
- Rules – Selecting Variables for Indexes
- Rules – Indexes and the Optimizer
- Viewing and Validating Indexes
- Dashboard User Interfaces
- Features
- Types of Dashboards
- Static Dashboards
- Interactive “Drill-down” Dashboards
- Static Dashboard Example
- Interactive “Drill-down” Dashboard Example
- Dictionary Tables and SASHELP Views
- Features
- Metadata Access Methods
- Traditional PROC CONTENTS (or PROC DATASETS)
- Dictionary Tables and SASHELP Views
- Viewing Dictionary Tables Metadata Content
- Examples
- SAS Arrays
- Access Multi-platform Data