Carpenter s Complete Guide to the SAS Macro Language, Third Edition
514 pages
English

Vous pourrez modifier la taille du texte de cet ouvrage

Découvre YouScribe en t'inscrivant gratuitement

Je m'inscris

Carpenter's Complete Guide to the SAS Macro Language, Third Edition , livre ebook

-

Découvre YouScribe en t'inscrivant gratuitement

Je m'inscris
Obtenez un accès à la bibliothèque pour le consulter en ligne
En savoir plus
514 pages
English

Vous pourrez modifier la taille du texte de cet ouvrage

Obtenez un accès à la bibliothèque pour le consulter en ligne
En savoir plus

Description

For SAS programmers or analysts who need to generalize their programs or improve programming efficiency, Art Carpenter thoroughly updates his highly successful second edition of Carpenter's Complete Guide to the SAS Macro Language with an extensive collection of new macro language techniques and examples.


Addressing the composition and operation of the SAS macro facility and the SAS macro language, this third edition offers nearly 400 ready-to-use macros, macro functions, and macro tools that enable you to convert SAS code to macros, define macro variables, and more! Users with a basic understanding of Base SAS who are new to the SAS macro language will find more detail, utilities, and references to additional learning opportunities; advanced macro language programmers who need help with data-driven macros and dynamic application development will find greatly expanded treatment of these topics.


This revised and enlarged edition includes the following topics:


  • New and expanded introduction to the macro language

  • Functions, automatic macro variables, and macro statements new to the macro language

  • Expanded macro language tools that interface with the operating system

  • Expanded data-driven methodologies used to build dynamic applications

  • Expanded discussion of list processing, with four alternative approaches presented

  • Additional file and data management examples

  • Expanded discussion of CALL EXECUTE and DOSUBL

  • New discussion of using the macro language on remote servers

  • Expanded discussion and examples of macro quoting


Far beyond a reference manual issued from an “ivory tower,” this book is pragmatic and example-driven: Yes, you will find syntax examples; yes, the code is explained. But the focus of this book is on actual code used to solve real-world business problems. In fact, an entire appendix is dedicated to listing the nearly 70 classes of problems that are solved by programs covered in this edition. Discussion of the examples elucidates the pros and cons of the particular solution and often suggests alternative approaches. Therefore, this book provides you both a compendium of reusable and adaptable code, and opportunities for deepening your understanding and growing as a SAS programmer.

Informations

Publié par
Date de parution 25 août 2016
Nombre de lectures 0
EAN13 9781629602370
Langue English
Poids de l'ouvrage 18 Mo

Informations légales : prix de location à la page 0,0160€. Cette information est donnée uniquement à titre indicatif conformément à la législation en vigueur.

Extrait

Carpenter s Complete Guide to the SAS Macro Language
Third Edition
Art Carpenter
support.sas.com/bookstore
The correct bibliographic citation for this manual is as follows: Carpenter, Art. 2016. Carpenter s Complete Guide to the SAS Macro Language, Third Edition . Cary, NC: SAS Institute Inc.
Carpenter s Complete Guide to the SAS Macro Language, Third Edition
Copyright 2016, SAS Institute Inc., Cary, NC, USA
ISBN 978-1-62959-268-8 (Hard copy) ISBN 978-1-62960-237-0 (EPUB) ISBN 978-1-62960-238-7 (MOBI) ISBN 978-1-62960-239-4 (PDF)
All Rights Reserved. Produced in the United States of America.
For a hard-copy book: No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, or otherwise, without the prior written permission of the publisher, SAS Institute Inc.
For a web download or e-book: Your use of this publication shall be governed by the terms established by the vendor at the time you acquire this publication.
The scanning, uploading, and distribution of this book via the Internet or any other means without the permission of the publisher is illegal and punishable by law. Please purchase only authorized electronic editions and do not participate in or encourage electronic piracy of copyrighted materials. Your support of others rights is appreciated.
U.S. Government License Rights; Restricted Rights: The Software and its documentation is commercial computer software developed at private expense and is provided with RESTRICTED RIGHTS to the United States Government. Use, duplication, or disclosure of the Software by the United States Government is subject to the license terms of this Agreement pursuant to, as applicable, FAR 12.212, DFAR 227.7202-1(a), DFAR 227.7202-3(a), and DFAR 227.7202-4, and, to the extent required under U.S. federal law, the minimum restricted rights as set out in FAR 52.227-19 (DEC 2007). If FAR 52.227-19 is applicable, this provision serves as notice under clause (c) thereof and no other notice is required to be affixed to the Software or documentation. The Government s rights in Software and documentation shall be only those set forth in this Agreement.
SAS Institute Inc., SAS Campus Drive, Cary, NC 27513-2414
March 2017
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. indicates USA registration.
Other brand and product names are trademarks of their respective companies.
SAS software may be provided with certain third-party software, including but not limited to open-source software, which is licensed under its applicable third-party software license agreement. For license information about third-party software distributed with SAS software, refer to http://support.sas.com/thirdpartylicenses .
Contents
Acknowledgments
About This Book
About The Author
Part 1: Macro Basics
Chapter 1: What the Language Is, What It Does, and What It Can Do
1.1 Introduction
1.2 Stages of Macro Language Learning
1.2.1 Code Substitution
1.2.2 Macro Language Elements
1.2.3 Dynamic Programming
1.3 Terminology
1.4 Sequencing Events-It s All about the Timing
1.5 Scopes or Referencing Environments
1.5.1 Use of Symbol Tables
1.5.2 Nested Symbol Tables
Chapter 2: Defining and Using Macro Variables
2.1 Naming Macro Variables
2.2 Defining Macro Variables
2.3 Using Macro Variables
2.4 Displaying Macro Variables by Using the %PUT Statement
2.5 Resolving Macro Variables
2.5.1 Using the Macro Variable as a Suffix
2.5.2 Using the Macro Variable as a Prefix
2.5.3 Using Macro Variables as Building Blocks-Appending Macro Variables
2.5.4 Understanding Results When Macro References Are Not Resolved
2.6 Using Automatic Macro Variables
2.6.1 SYSDATE, SYSDATE9, SYSDAY, and SYSTIME
2.6.2 SYSLAST and SYSDSN
2.6.3 SYSERR and SYSCC
2.6.4 SYSRC
2.6.5 SYSSITE, SYSSCP, SYSSCPL, and SYSUSERID
2.6.6 SYSMACRONAME
2.7 Removing Macro Variables
2.8 Testing Your Knowledge with Chapter Exercises
Chapter 3: Defining and Using Macros
3.1 Creating a Macro
3.1.1 Defining a Macro
3.1.2 Commenting a Block of Code with Use of %MACRO and %MEND
3.1.3 Using the /DES Macro Statement Option
3.2 Invoking a Macro
3.3 Using System Options with the Macro Facility
3.3.1 General Macro Options
3.3.2 Debugging Options
3.3.3 Use of the Debugging Options
3.3.4 Autocall Facility Options
3.4 Testing Your Knowledge with Chapter Exercises
Chapter 4: Using Macro Parameters
4.1 Introducing Macro Parameters
4.2 Using Positional Parameters
4.2.1 Defining the Macro s Parameters
4.2.2 Passing Parameter Values into the Macro
4.3 Using Keyword Parameters
4.3.1 Defining the Parameters and Their Default Values
4.3.2 Passing Parameter Values When Calling the Macro
4.3.3 Documenting Your Macro
4.4 Choosing between Keyword and Positional Parameters
4.4.1 Selecting Parameter Types
4.4.2 Using Keyword and Positional Parameters Together
4.4.3 Naming Keyword Parameters without the Equal Sign
4.5 Testing Your Knowledge with Chapter Exercises
Part 2: Using Macros
Chapter 5: Controlling Programs with Macros
5.1 Macros That Invoke Macros
5.1.1 Passing Parameters between Macros
5.1.2 Passing Parameters When Macros Call Macros
5.1.3 Passing Macro Parameters through Macro Calls-An Illustrated Example
5.1.4 Controlling Macro Calls
5.1.5 Nesting Macro Definitions
5.2 Conditional Execution Using %IF-%THEN/%ELSE Statements
5.2.1 Executing Macro Statements
5.2.2 Building SAS Code Dynamically
5.2.3 Using the IN Comparison Operator
5.3 Iterative Execution of Macro Statements
5.3.1 %DO Block
5.3.2 Iterative %DO Loops
5.3.3 %DO %UNTIL Loops
5.3.4 %DO %WHILE Loops
5.4 Additional Macro Program Statements
5.4.1 Macro Comments
5.4.2 %GLOBAL and %LOCAL
5.4.3 %SYSEXEC
5.4.4 Termination of Macro Execution with %ABORT
5.4.5 Normal Termination of Macro Execution with %RETURN
5.5 Testing Your Knowledge with Chapter Exercises
Chapter 6: Interfacing with Data Set Values
6.1 Using the SYMPUTX Routine to Create Macro Variables
6.1.1 Introducing SYMPUTX Syntax
6.1.2 Comparing SYMPUTX with SYMPUT
6.1.3 Using a Macro Variable in the Same Step That Created It
6.1.4 Building a List of Macro Variables
6.2 Defining Macro Variables in a PROC SQL Step
6.2.1 Placing a Single Value into a Single Macro Variable
6.2.2 Building a List of Values
6.2.3 Placing a List of Values into a Series of Macro Variables
6.2.4 Understanding Automatic SQL-Generated Macro Variables
6.3 Moving Text from Macro Variables into Code
6.3.1 Assignment and RETAIN Statements
6.3.2 SYMGET and SYMGETN Functions
6.3.3 The RESOLVE Function
6.3.4 Comparison of the SYMGET and RESOLVE Functions
6.3.5 Less-Than-Optimal Uses of SYMGET and RESOLVE
6.4 Using Data to Control Program Flow
6.4.1 Assigning Macro Variable Values
6.4.2 Assigning Macro Variable Names as well as Values
6.5 Executing Macro Code Using CALL EXECUTE
6.5.1 Executing Non-Macro Code
6.5.2 Executing Macro Code
6.5.3 Addressing Timing Issues
6.6 Testing Your Knowledge with Chapter Exercises
Chapter 7: Using Macro Functions
7.1 Quoting Functions
7.1.1 Using the %BQUOTE Function
7.1.2 %STR
7.1.3 Considerations When Quoting
7.1.4 Basic Types of Quoting Functions and Why We Care
7.1.5 A Bit about the %QUOTE and %NRQUOTE Functions
7.1.6 Removing Masking Characters
7.1.7 The %SUPERQ Quoting Function
7.1.8 Quoting Function Summary
7.1.9 Quoting Mismatched Symbols with the %STR and %QUOTE Functions
7.2 Text Functions
7.2.1 %INDEX
7.2.2 %LENGTH
7.2.3 %SCAN and %QSCAN
7.2.4 %SUBSTR and %QSUBSTR
7.2.5 %UPCASE and %QUPCASE
7.2.6 %LEFT and %QLEFT
7.2.7 %LOWCASE and %QLOWCASE
7.2.8 %TRIM and %QTRIM
7.3 Evaluation Functions
7.3.1 Explicit Use of %EVAL
7.3.2 Implicit Use of %EVAL
7.3.3 Using %SYSEVALF
7.4 Using DATA Step Functions and Routines
7.4.1 Using %SYSCALL
7.4.2 Using %SYSFUNC and %QSYSFUNC
7.4.3 Taking Advantage of Less Commonly Used DATA Step Functions
7.5 Building Your Own Macro Functions
7.5.1 Introduction
7.5.2 Building the Function
7.5.3 Using the Function
7.5.4 Returning a Value
7.6 Other Useful User-Written Macro Functions
7.6.1 One-Liners
7.6.2 Macro Functions with Logic
7.6.3 Functions for the DATA Step
7.7 Testing Your Knowledge with Chapter Exercises
Chapter 8: Discovering Even More Macro Language Elements
8.1 Even More Macro Functions
8.1.1 Accessing System Environmental Variables Using %SYSGET
8.1.2 %SYSMEXECDEPTH and %SYSMEXECNAME
8.1.3 Assessing Macro Existence and Execution Status with % SYSMACEXEC and %SYSMACEXIST
8.1.4 Determining Product Availability Using %SYSPROD
8.1.5 Checking Up on Macro Variable Scopes
8.2 Even More Macro Statements
8.2.1 Extending the Use of %SYMDEL
8.2.2 Using the %GOTO and %label Statements Appropriately
8.2.3 Using %WINDOW and %DISPLAY
8.2.4 Extending %

  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents