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.

Using the Macro Facility 1723<br />

• In Figure D.8, the syntax for declaring keyword arguments follows the name of the<br />

macro in DEFINE.<br />

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

the argument in the macro call. Thus the first macro call specifies CLASS as the value<br />

of BREAKVR, MEAN as the value of FUNC, and ABSENT as the value of INVAR.<br />

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

(SCHOOL.SAV).<br />

• TEMP is an optional argument that names an intermediate file to contain the summary<br />

statistics. Since TEMP is not assigned a value in the macro call, summary statistics are<br />

written to the default intermediate file (TOTALS.SAV).<br />

• In the body of the macro, GET FILE opens SCHOOL.SAV.<br />

• SORT CASES sorts the file by CLASS.<br />

• AGGREGATE computes the mean number of absences for each class. The name of the<br />

variable containing the means (MEAN@) is constructed using the !CONCAT function,<br />

which concatenates the value of FUNC and the @ symbol.<br />

• MATCH FILES appends the means to student records.<br />

• COMPUTE calculates the deviation from the classroom mean for each student (variable<br />

DIFF).<br />

• LIST displays the deviation scores, as shown in Figure D.9. For example, John D., who<br />

was absent 12 times, had 6.75 more absences than the average student in classroom<br />

102. Rich H., who was absent 4 times, had 1.25 fewer absences than the average student<br />

in classroom 102.<br />

• The second macro call and remaining commands in Figure D.8 generate regional sales<br />

percentages for the 1989 sales data. As shown in Figure D.9, percentages are identical<br />

to those displayed in the bottom half of Figure D.6.<br />

Figure D.9 Student absences and 1989 sales percentages<br />

CLASS STUDENT ABSENT MEAN@ DIFF<br />

101 BARRY G 3 3.50 -.50<br />

101 JENNI W 1 3.50 -2.50<br />

101 ED F 2 3.50 -1.50<br />

101 JOHN 0 8 3.50 4.50<br />

102 PAUL Y 2 5.25 -3.25<br />

102 AMY G 3 5.25 -2.25<br />

102 JOHN D 12 5.25 6.75<br />

102 RICH H 4 5.25 -1.25<br />

YEAR REGION SALESPER SALES SUM@ PCT<br />

1989 BATON ROUGE GRAU 320 1459.00 22.00<br />

1989 BATON ROUGE SMITH 800 1459.00 55.00<br />

1989 BATON ROUGE RODRIGUEZ 339 1459.00 23.00<br />

1989 CHICAGO JONES 300 1439.00 21.00<br />

1989 CHICAGO STEEL 899 1439.00 62.00<br />

1989 CHICAGO GREGORY 240 1439.00 17.00

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

Saved successfully!

Ooh no, something went wrong!