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.

Figure D.17 Descriptive statistics for generated data<br />

Valid<br />

Variable Mean Std Dev Minimum Maximum N Label<br />

X1 -.01 1.02 -3.11 4.15 1000<br />

X2 .08 1.03 -3.19 3.22 1000<br />

X3 .02 1.00 -3.01 3.51 1000<br />

X4 .03 1.00 -3.35 3.19 1000<br />

X5 -.01 .96 -3.34 2.91 1000<br />

Using the Macro Facility 1729<br />

The !DATAGEN macro in Figure D.18 issues the data-generating commands shown in<br />

Figure D.16.<br />

Figure D.18 !DATAGEN macro<br />

DEFINE !DATAGEN ().<br />

INPUT PROGRAM.<br />

- VECTOR X(5).<br />

- LOOP #I = 1 TO 1000.<br />

- LOOP #J = 1 TO 5.<br />

- COMPUTE X(#J) = NORMAL(1).<br />

- END LOOP.<br />

- END CASE.<br />

- END LOOP.<br />

- END FILE.<br />

END INPUT PROGRAM.<br />

DESCRIPTIVES VARIABLES X1 TO X5.<br />

!ENDDEFINE.<br />

!DATAGEN.<br />

In Figure D.18, data-generating commands are imbedded between macro definition<br />

commands. The macro produces the same data and descriptive statistics as shown in<br />

Figure D.17.<br />

You can tailor the generation of normally distributed variables if you modify the<br />

!DATAGEN macro so it will accept keyword arguments, as in Figure D.19. The macro<br />

allows you to specify the number of variables and cases to be generated and the approximate<br />

standard deviation.

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

Saved successfully!

Ooh no, something went wrong!