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.

1262 PRINT SPACE<br />

Example<br />

PRINT / NAME DEPT82 *<br />

MOHIRED(T30,F2) ’/’ YRHIRED *<br />

SALARY82 (T35,DOLLAR8).<br />

PRINT SPACE.<br />

EXECUTE.<br />

• PRINT SPACE displays one blank line each time it is executed. Because PRINT SPACE is<br />

not used in a DO IF—END IF structure, it is executed once for each case. In effect, the<br />

output is double-spaced.<br />

Example<br />

NUMERIC #LINE.<br />

DO IF MOD(#LINE,5) = 0.<br />

PRINT SPACE 2.<br />

END IF.<br />

COMPUTE #LINE=#LINE + 1.<br />

PRINT / NAME DEPT *<br />

MOHIRED 30-31 ’/’ YRHIRED *<br />

SALARY 35-42(DOLLAR).<br />

EXECUTE.<br />

• DO IF specifies that PRINT SPACE will be executed if MOD (the remainder) of #LINE<br />

divided by 5 equals 1. Since #LINE is incremented by 1 for each case, PRINT SPACE is<br />

executed once for every five cases. (See p. 38 for information on the MOD function.)<br />

• PRINT SPACE specifies two blank lines. Cases are displayed in groups of five with two<br />

blank lines between each group.<br />

Example<br />

* Printing addresses on labels.<br />

COMPUTE #LINES=0. /*Initiate #LINES to 0<br />

DATA LIST FILE=ADDRESS/RECORD 1-40 (A). /*Read a record<br />

COMPUTE #LINES=#LINES+1. /*Bump counter and print<br />

WRITE OUTFILE=LABELS /RECORD.<br />

DO IF RECORD EQ ’ ’. /*Blank between addresses<br />

+ PRINT SPACE OUTFILE=LABELS 8 - #LINES. /*Add extra blank #LINES<br />

+ COMPUTE #LINES=0.<br />

END IF.<br />

EXECUTE.<br />

• PRINT SPACE uses a complex expression for specifying the number of blank lines to display.<br />

The data contain a variable number of input records for each name and address,<br />

which must be printed in a fixed number of lines for mailing labels. The goal is to know<br />

when the last line for each address has been printed, how many lines have printed, and<br />

therefore how many blank records must be printed in order for the next address to fit on<br />

the next label. The example assumes that there is already one blank line between each<br />

address on input and that you want to print eight lines per label.

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

Saved successfully!

Ooh no, something went wrong!