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.

Figure D.14 !CORRTST macro with list-processing loop<br />

DEFINE !CORRTST (R = !TOKENS(1)<br />

/N = !TOKENS(1)<br />

/P = !CMDEND).<br />

- INPUT PROGRAM.<br />

- END CASE.<br />

- END FILE.<br />

- END INPUT PROGRAM.<br />

!DO !I !IN (!P).<br />

- COMPUTE #ZR = .5* (LN ((1 + !R) / (1 - !R))).<br />

- COMPUTE #ZP = .5* (LN ((1 + !I) / (1 - !I))).<br />

- COMPUTE Z = (#ZR-#ZP)/(1/(SQRT(!N-3))).<br />

Using the Macro Facility 1727<br />

- COMPUTE PROB=2*(1-CDFNORM(ABS(Z))).<br />

- FORMAT PROB(F8.3).<br />

- TITLE SAMPLE R=!R, N=!N, POPULATION COEFFICIENT=!I.<br />

- LIST.<br />

!DOEND.<br />

!ENDDEFINE.<br />

!CORRTST R=.66 N=30 P=.20 .40 .60 .80 .85 .90.<br />

• As in Figure D.12, DEFINE names the macro as !CORRTST and declares arguments for<br />

the sample correlation coefficient (R), the sample size (N), and the population correlation<br />

coefficient (P).<br />

• !TOKENS(1) specifies that the value of an argument is a string that follows the name of<br />

the argument in the macro call. Thus, the macro call specifies the value of R as 0.66 and<br />

N as 0.30.<br />

• !CMDEND indicates that the value for P is the remaining text in the macro call. Thus<br />

the value of P is a list containing the elements 0.20, 0.40, 0.60, 0.80, 0.85, and 0.90.<br />

• <strong>Command</strong>s !DO !IN and !DOEND define a list-processing loop. <strong>Command</strong>s in the loop<br />

compute one Z statistic for each element in the list of population coefficients. For<br />

example, in the first iteration Z is computed using 0.20 as the population coefficient. In<br />

the second iteration 0.40 is used. The same sample size (30) and r value (0.66) are used<br />

for each Z statistic.<br />

• The output from the macro call is shown in Figure D.15. One Z statistic is displayed for<br />

each population coefficient.

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

Saved successfully!

Ooh no, something went wrong!