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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

38 Universals<br />

• You can specify as many digits in a constant as needed, as long as you understand the<br />

precision restrictions of your computer.<br />

• Numeric constants can be signed (+ or −) but cannot contain any other special characters<br />

such as the comma or dollar sign.<br />

• Numeric constants can be expressed with scientific notation. Thus, the exponent for a<br />

constant in scientific notation is limited to two digits. The range of values allowed for<br />

exponents in scientific notation is from −99 to +99.<br />

Complex Numeric Arguments<br />

• Except where explicitly restricted, complex expressions can be formed by nesting<br />

functions and arithmetic operators as arguments to functions.<br />

• The order of execution for complex numeric arguments is functions first, then exponentiation,<br />

then multiplication, division, and unary −, and then addition and subtraction.<br />

• To control the order of execution in complex numeric arguments, use parentheses.<br />

Numeric Functions<br />

Numeric functions can be used in any numeric expression on IF, SELECT IF, DO IF, ELSE IF,<br />

LOOP IF, END LOOP IF, and COMPUTE commands. Numeric functions always return numbers<br />

(or the system-missing value whenever the result is indeterminate). The expression to be<br />

transformed by a function is called the argument. Most functions have a variable or a list of<br />

variables as arguments.<br />

• In numeric functions with two or more arguments, each argument must be separated by<br />

a comma. Blanks alone cannot be used to separate variable names, expressions, or<br />

constants in transformation expressions.<br />

• Arguments should be enclosed in parentheses, as in TRUNC(INCOME), where the TRUNC<br />

function returns the integer portion of the variable INCOME.<br />

• Multiple arguments should be separated by commas, as in MEAN(Q1,Q2,Q3), where the<br />

MEAN function returns the mean of variables Q1, Q2, and Q3.<br />

Arithmetic Functions<br />

• All arithmetic functions except MOD have single arguments; MOD has two. The arguments<br />

to MOD must be separated by a comma.<br />

• Arguments can be numeric expressions, as in RND(A**2/B).<br />

ABS(arg) Absolute value. ABS(SCALE) is 4.7 when SCALE equals 4.7 or −4.7.<br />

RND(arg) Round the absolute value to an integer and reaffix the sign. RND(SCALE) is<br />

−5 when SCALE equals −4.7.<br />

TRUNC(arg) Truncate to an integer. TRUNC(SCALE) is −4 when SCALE equals −4.7.<br />

MOD(arg,arg) Remainder (modulo) of the first argument divided by the second. When<br />

YEAR equals 1983, MOD(YEAR,100) is 83.

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

Saved successfully!

Ooh no, something went wrong!