Book description
Learn to write SAS programs quickly and efficiently.
Programming in SAS is flexible, but it can also be overwhelming. Many novice and experienced programmers learn how to write programs that use the DATA step and macros, but they often don’t realize that a simpler or better way can achieve the same results. In a user-friendly tutorial style, Practical and Efficient SAS® Programming: The Insider's Guide provides general SAS programming tips that use the tools available in Base SAS, including the DATA step, the SAS macro facility, and SQL.
Drawing from the author’s 30 years of SAS programming experience, this book offers self-contained sections that describe each tip or trick and present numerous examples. It therefore serves as both an easy reference for a specific question, and a useful cover-to-cover read. As a bonus, the utility programs included in the appendixes will help you simplify your programs, as well as help you develop a sleek and efficient coding style.
With this book, you will learn how to do the following:
use the DATA step, the SAS macro facility, SQL, and other Base SAS tools more efficiently
choose the best tool for a task
use lookup tables
simulate recursion with macros
read metadata with the DATA step
create your own programming style in order to write programs that are easily maintained
Using this book, SAS programmers of all levels will discover new techniques to help them write programs quickly and efficiently.
Table of contents
- About This Book
- About The Author
- Acknowledgments
- Chapter 1: My Favorite Functions
- Introduction
- Concatenating Strings
- Removing Leading and Trailing Spaces
- Finding Non-Blank Values
- Creating Datetime Values
- Creating Macro Variables
- Finding Words
- Counting Words
- Replacing Substrings
- Using %SYSFUNC() to Run DATA Step Functions
- Chapter 2: Data Tables
- Introduction
- Copying Variable Attributes
- Reading Data with a SET Statement
- Determining Which Table a Record Is From
- Using PROC SQL
- Using Lookup Tables
- Updating Data In Place
- Finding Records
- Re-creating Indexes
- Chapter 3: The Operating System
- Introduction
- Checking the Operating System
- Running Operating System Commands
- Working with the File System
- Reading and Writing External Files
- Creating a CSV File from a Data Table
- Reading a CSV File with Embedded Line Feeds
- Chapter 4: The Macro Facility
- Introduction
- Understanding Macro Variables
- Writing Macros
- Chapter 5: SAS Programming
- Introduction
- Using the ABORT Statement
- Updating Option Values
- Getting Information from SASHELP Views
- Creating a Unique Key with PROC SQL
- Setting a Boolean
- Accumulating Values
- Replacing a Substring
- Using Data Values Tables to Create and Run Code
- Taking Control of DATA Step Processing
- Figuring Out Where You Are
- Chapter 6: Application Development
- Introduction
- Using Comments
- Dealing with Notes, Warnings, and Errors
- Protecting Your Password
- Using the PUT, PUTLOG, and %PUT statements
- Chapter 7: Advanced Tasks
- Introduction
- Sending Email
- Running Code in Parallel
- Simulating Recursion
- Reading Metadata
- Using the XML LIBNAME Engine
- Appendix A: Utility Macros
- Introduction
- Deleting Tables
- Getting the Number of Records
- Getting a Library’s Engine Name
- Getting a Variable Keep List
- Making ATTRIB Statements
- Making a Basic Format
- Making a Directory Path
- Creating Macro Variables from SYSPARM
- Setting Log Options
- Displaying Macro Notes for Debugging
- Refreshing Autocall Macros
- Appendix B: Display Manager
- Introduction
- Using the Enhanced Editor
- Using the Program Editor
- Handling Unbalanced Quotation Marks
- Appendix C: Coding Style
- Introduction
- Indenting
- Aligning
- Handling Line Lengths
- Using Capital Letters (or Not)
- Naming
- Coding with Style
- References
- Index
Product information
- Title: Practical and Efficient SAS Programming
- Author(s):
- Release date: September 2017
- Publisher(s): SAS Institute
- ISBN: 9781635262223
You might also like
book
Getting Started with SAS Programming
Get up and running with SAS using Ron Cody’s easy-to-follow, step-by-step guide. Aimed at beginners, Getting …
book
SAS Programming and Data Visualization Techniques: A Power User’s Guide
SAS Programming and Data Visualization Techniques: A Power User’s Guide brings together a wealth of ideas …
video
Mastering SAS Programming
SAS is one of the most popular applications for data analysis and is used widely in …
book
The SAS Programmer's PROC REPORT Handbook
Generate reports with style! The SAS Programmer's PROC REPORT Handbook: ODS Companion explains how to use …