27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

458 DEFINE—!ENDDEFINE<br />

Direct Assignment of Macro Variables<br />

The macro command !LET assigns values to macro variables. The syntax is as follows:<br />

!LET !var = expression<br />

• The expression must be either a single token or enclosed in parentheses.<br />

• The macro variable !var cannot be a macro keyword (see the syntax chart on p. 440 for a<br />

list of macro keywords), and it cannot be the name of one of the arguments within the<br />

macro definition. Thus, !LET cannot be used to change the value of an argument.<br />

• The macro variable !var can be a new variable or one previously assigned by a !DO<br />

command or another !LET command.<br />

Example<br />

!LET !a = 1<br />

!LET !b = !CONCAT(ABC,!SUBSTR(!1,3,1),DEF)<br />

!LET !c = (!2 ~= !NULL)<br />

• The first !LET sets !a equal to 1.<br />

• The second !LET sets !b equal to ABC followed by 1 character taken from the third position<br />

of !1 followed by DEF.<br />

• The last !LET sets !c equal to 0 (false) if !2 is a null string or to 1 (true) if !2 is not a null<br />

string.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!