Index

A

%ABORT statement 111

ampersand (&)

assigned to macro variable 48–49

treating as text 68

arithmetic

automatic evaluation of 90–92, 93–94

boolean 89–92

evaluation of 87–88

%LET statement ignoring 87

ASCII values, sorting 11

B

backtesting 129–137

blanks

See also null

added inadvertently 46, 47–48

as separators 66

ignored by %LET statement 46

removing 38–39, 53–54, 57

boolean arithmetic 89–92

%BQUOTE function 69

C

CALL EXECUTE statement 23–33

complex expressions in 27

DATA step in 27

in DATA step 26, 27, 28–29, 30–32

in IF THEN statement 26

multiple 26–27

order of execution affected by 24, 27–33

PROC step in 25

usage rules 23–24, 27–29

CALL SYMPUT statement 32–33, 45–54

blanks, removing 53–54

blanks added inadvertently 46, 47–48

live % assigned to macro variable 49–51

live & assigned to macro variable 48–49

macro variables created by 81–83

potential problems caused by 45–46

recursive statements assigned to macro variable 47

CALL SYMPUTX statement 53–54, 83–84

comma (,), treating as text 68

comments, not ended 18–19

COMPBL function 100

complexity 115–128

See also simplification

execution speed affecting 124–126

invalid reasons for 115–117

portability affecting 123–124

reliability improved by 121–123

usability improved by 119–121, 126–128

valid reasons for 115

COMPRESS function 9, 38–39, 100, 121

conditional statements

See also IF THEN statement

See also %IF %THEN statement

conditional execution of %LET statement 28–30

%SYSFUNC function using 39–40

CONTENTS procedure 109

conversion, numeric-to-character

with CALL SYMPUT statement 46, 53

with CALL SYMPUTX statement 53–54

with INTO : operator 56, 60

COUNT function 59

COUNTW function 100

CREATE TABLE statement 65

D

DATA step

CALL EXECUTE statement in 26, 27, 28–29, 30–32

IF THEN statement in 26, 28–29

in CALL EXECUTE statement 27

order of execution in 24, 27–33, 117

PROC step not allowed in 24–25

quotes in 32–33, 68

RUN statement missing from 27–28

&SYSERR set by 110

debugging 107–113

diagnostic steps in macro 109–110

difficulty of, reasons for 107

ending program when errors occur 110–113

interactive sessions 112–113

storing generated SAS code 108–109

strategies for 107–108

dictionary tables, reading 62–64

%DO statement 90, 116

double quotes (" ")

See also quoting

allowing macro variable resolution 32–33, 70

preventing arithmetic evaluation 91–92

E

ENDSAS statement 111

errors

See debugging

%EVAL function 87–94

automatic use of 90–92

boolean results from 89

unnecessary complexity using 116–117, 118

EXIST function 36, 122

F

false values

See boolean arithmetic

FEXIST function 122

FILEEXIST function 122

FORMAT statement 43–44, 63

FREQ procedure 109

G

GETOPTION function 37–38, 40–41

%GLOBAL statement 79–80

global variables

creating 79–80

deleting 78

determining existence of 84–85

persisting information using 85–86

searched after local variables 80

when created by CALL SYMPUT 81–83

when created by CALL SYMPUTX 83

H

hung sessions, causes of 18–19

I

%IF %THEN statement

%EVAL automatically used by 90–92, 93–94

not allowed in open code 25–26, 39–40

strings not padded in comparisons 48

IF THEN statement

assembling with INTO : operator 61–62

CALL EXECUTE statement in 26

in DATA step 26, 28–29

simplifying 3–5

strings padded in comparisons 48

IFN function 39–40

%INCLUDE statement 134–135, 137

interactive sessions

debugging 112–113

portability allowing for 123–124

unresponsive, causes of 18–19

INTO: operator, SQL procedure 55–66

assembling IF THEN statement 61–62

creating multiple macro variables 57–59

creating single macro variable 55–57, 66

creating variable number of macro variables 58–59

numeric-to-character conversion with 56, 60

reading dictionary tables 62–64

J

job security, complex macros increasing 115–117

L

LENGTHN function 6

%LET statement

arithmetic ignored in 87

blanks ignored by 46

conditional execution of, in DATA step 28–29

embedding statements in 14–18, 47

lists

long, output tables for 64–65

parsing 128

removing duplicate words from 101–103

%LOCAL statement 79–80

local variables

advantages of 78

creating 79–80

determining existence of 84–85

importance of defining 80–81

searched before global variables 80

symbol table for, when created 78–80, 82–83

symbol table for, when deleted 78

when created by CALL SYMPUT 81–83

when created by CALL SYMPUTX 83

M

macro language

advances in, keeping up with 13–14

experimentation with 14–19

quotes in 32–33, 68, 70

macro variables

See also global variables

See also local variables

checking for existence of 122–123

concatenating multiple results into 55–57, 60–61, 66

concatenating multiple results into a set of 57–59

created by CALL SYMPUT 81–83

created by CALL SYMPUTX 83

determining whether local or global 84–85

live % assigned to 49–51

live & assigned to 48–49

order assigned by SELECTs 58

output table as alternative to 64–65

persisting beyond macro 85–86

recursive statements assigned to 47

resolution of, preventing 32–33

macros

automated changes to 126–127

backtesting 129–137

changing function for each execution 50–53

complexity of 115–128

debugging 107–113

not ended 18–19

order of execution in 24, 27–33, 117, 118

parameters for 85–86, 119–123

portability of 123–124

simplification of 13–19

text generation using 103–105

math

See arithmetic

MAUTOLOCDISPLAY option 107

MEANS procedure 109, 112

MFILE option 108

MLOGICNEST option 107

MPRINTNEST option 107

N

NOBS= option, SET statement 103

NOTRIM function 57–58

%NRBQUOTE function 69

%NRSTR function 32, 68

null

See also blanks

as separator 66, 85

comparisons with 118

messages 112

numeric-to-character conversion

with CALL SYMPUT statement 46, 53

with CALL SYMPUTX statement 53–54

with INTO : operator 56, 60

O

operating system

determining 124

portability between 123–124

option settings, capturing and modifying 40–41

order of execution 24, 27–33, 117, 118

P

parameters

checking validity of 121–123

optional 119–121

persisting information using 85–86

variable lists in 128

percent sign (%)

assigned to macro variable 49–51

treating as text 68

portability 123–124

PRINT procedure 109

PROC step

in CALL EXECUTE statement 25

not allowed in DATA step 24–25

&SYSERR set by 110

process name, determining 124

program variables

lowest values of, finding 10–11

renaming 7–8

programs

See also SAS language

ending when errors occur 110–113

name of, capturing 37–38

simplification of 3–6

storing generated code for 108–109

PUT function

not allowed in %SYSFUNC function 36

numeric-to-character conversion by 53–54

PUTN function 36

Q

%QSYSFUNC function 39

quotes

double (" "), allowing macro variable resolution 32–33, 70

double (" "), preventing arithmetic evaluation 91–92

single (' '), preventing macro variable resolution 32–33, 68

unmatched 18–19

quoting 67–75

compile time handling of 69–70

examples 75

execution time handling of 69–70

internal handling of 70–74

mistakes using 67–68

R

renaming variables 7–8

RETAIN statement 41–42

RUN statement

checking for errors after 111–112

missing from DATA step 27–28

S

SAS language

See also programs

advances in, keeping up with 6–9

experimentation with 10–11

generated from macros, storing 108–109

SAS_EXECFILENAME environment variable 37

SAS_EXECFILEPATH environment variable 37

SASHELP.VEXTFL view 37

SASHELP.VMACRO data set 84–85

%SCAN function 13–14, 90, 99

SCAN function 8–9, 134

SELECT DISTINCT statement

order macro variables assigned by 58

zero results from 59

SELECT statement

creating multiple macro variables 57–59

creating single macro variable 55–57

creating variable number of macro variables 58–59

immediate execution of 55–56

order macro variables assigned by 58

SEPARATED BY clause 66

zero results from 59

semicolon (;)

generating 97

treating as text 68

SEPARATED BY clause, SELECT statement 66

sessions, interactive

debugging 112–113

portability allowing for 123–124

unresponsive, causes of 18–19

SET statement, NOBS= option 103

simplification

See also complexity

of macros 13–19

of programs 3–6

single quotes (' ')

See also quoting

preventing macro variable resolution 32–33, 68

software license renewal warnings 113

special characters

See also ampersand (&)

See also percent sign (%)

See also quotes

masking at compile time 32, 68

masking at execution 70

treating as text 68

SQL procedure

checking existence of variables 123

CREATE TABLE statement 65

INTO : operator 55–66

local symbol table created by 83

retrieving SASHELP.VMACRO values 85

&SQLOBS automatic variable 59, 60–61, 64

%STR function 68

strings

See also quotes

blanks, removing 38–39, 53–54, 57

blanks added inadvertently 46, 47–48

blanks ignored by %LET statement 46

blanks or null as separators in 66

counting words in 99–100

padded when comparing 48

removing duplicate words from a list 101–103

STRIP function 39, 53

%SUBSTR function 37–38

%SUPERQ function 70, 100

%SYMDEL function 78

SYMGET function 28–29

&SYSERR automatic variable 110–113

%SYSEVALF function 88, 89, 116

%SYSFUNC function 35–44, 100

calculated values, retaining 41–42

conditional statements using 39–40

examples 35–36

nesting 38–39

option settings, capturing and modifying 40–41

program name, capturing 37–38

ZIP codes, format of 42–44

%SYSGET function 37

SYSIN option 108

&SYSMACRONAME automatic variable 109

&SYSPROCESSNAME automatic variable 124

&SYSSCPL automatic variable 124

T

TABLES statement 109

text

See also special characters

See also strings

counting words in 99–100

generating 97–99, 103–105

removing duplicate words from a list 101–103

TODAY function 35–36

TRIM function 53

true values

See boolean arithmetic

U

%UPCASE function 77–78

usability 119–121

V

VAR statement 109

variables, macro

See also global variables

See also local variables

checking for existence of 122–123

concatenating multiple results into 55–57, 60–61, 66

variables, macro (continued)

concatenating multiple results into a set of 57–59

created by CALL SYMPUT 81–83

created by CALL SYMPUTX 83

determining whether local or global 84–85

live % assigned to 49–51

live & assigned to 48–49

order assigned by SELECTs 58

output table as alternative to 64–65

persisting beyond macro 85–86

recursive statements assigned to 47

resolution of, preventing 32–33

variables, program

lowest values of, finding 10–11

renaming 7–8

W

white space

See blanks

X

X command 132

Z

ZIP codes, format of 42–44

Symbols

& (ampersand)

assigned to macro variable 48–49

treating as text 68

, (comma), treating as text 68

" " (double quotes)

See also quoting

allowing macro variable resolution 32–33, 70

preventing arithmetic evaluation 91–92

% (percent sign)

assigned to macro variable 49–51

treating as text 68

; (semicolon)

generating 97

treating as text 68

' ' (single quotes)

See also quoting

preventing macro variable resolution 32–33, 68

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.121.101