Practical and Efficient SAS Programming: The Insider's Guide
Book information
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. Contents About This Book What Does This Book Cover? Is This Book for You? What Should You Know about the Examples? Software Used to Develop the Book's Content Example Code and Data We Want to Hear from You About The Author Acknowledgments Chapter 1: My Favorite Functions Introduction Concatenating Strings Converting Numbers to Characters Adding Delimiters Using the OF Shortcut 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 Concatenating Tables Interleaving Tables Using Multiple SET Statements Determining Which Table a Record Is From Using PROC SQL Choosing to Use PROC SQL Joining Using a Subquery Using a Correlated Subquery Using Lookup Tables Using a Format Using a Join Using a SET Statement With KEY= Using Hash Tables Updating Data In Place Using PROC SQL Using the MODIFY Statement Using PROC APPEND Finding Records Determining Whether a Table Exists Getting the Number of Records Verifying That a Table Has Records Re-creating Indexes Chapter 3: The Operating System Introduction Checking the Operating System Running Operating System Commands Using the X Statement Using the SYSTEM() Function Using a FILENAME Pipe Working with the File System Creating and Deleting Directories Working with Files Reading and Writing External Files Using the $VARYING. Format and Informat Using the FILEVAR= Option Reading Date and Time Values 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 Using the “Dot” in Macro Variable Names Determining How Many &s to Use Understanding Quotation Marks Using Macro Quoting Unquoting Forcing Single Quotation Marks Writing Macros Using Autocall Macros Determining When to Write a Macro Wrapping Long Lines of Code Using the IN Operator Testing for Blanks Validating Parameters Creating Macro Functions 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 Using Macro Variable Arrays Creating and Including Code Using CALL EXECUTE Taking Control of DATA Step Processing Branching Returning Deleting Subsetting Stopping Aborting Continuing Leaving Figuring Out Where You Are Counting Iterations Finding the End Finding Group Beginnings and Endings Chapter 6: Application Development Introduction Using Comments Choosing a Style Commenting Out Chunks of Code Dealing with Notes, Warnings, and Errors Getting Rid of Common Notes, Warnings, and Errors Creating Custom Error and Warning Messages Capturing Error and Warning Messages Protecting Your Password Encoding a Password Storing a Password Hiding a Password Using the PUT, PUTLOG, and %PUT statements Debugging with PUTLOG Using the VAR= Syntax Using Shortcuts Getting Rid of Unneeded Spaces Displaying a Macro Value in the SAS Log Using Macro Shortcuts Chapter 7: Advanced Tasks Introduction Sending Email A Single Message Multiple Messages Running Code in Parallel Using MPCONNECT Striping Data 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 Indenting Your Code Commenting Out a Section of Code Converting a String to Uppercase or Lowercase Removing Excessive White Space Opening a New Enhanced Editor Window Using the Program Editor Customizing Function Keys Setting Options Using Line Commands Working with the Recall Stack 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
Similar books
Practical and Efficient SAS Programming: The Insider’s Guide
2017 · PDF
Practical and Efficient SAS Programming: The Insider’s Guide
EPUB
MySQL® Notes for Professionals book
2018 · PDF
MrExcel 2022: Boosting Excel
2022 · PDF
MrExcel 2022: Boosting Excel
2022 · PDF
Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36
2010 · PDF
THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.
1858 · PDF
Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.
2022 · PDF