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.

LAG Function<br />

CREATE 311<br />

LAG creates new series by copying the values of the existing series and moving them forward<br />

the specified number of observations. This number is called the lag order. Table 1 shows a<br />

first-order lag for a hypothetical data set.<br />

• The specification on LAG is the name or names of the existing series and one or two lag<br />

orders, in parentheses.<br />

• At least one lag order must be specified; there is no default.<br />

• Two lag orders indicate a range. For example, 2,6 indicates lag orders two through six. A<br />

new series is created for each lag order in the range.<br />

• The number of new series specified must equal the number of existing series specified<br />

times the number of lag orders in the range.<br />

• The first n cases at the beginning of the new series, where n is the lag order, are assigned<br />

the system-missing value.<br />

• Missing values in the existing series are lagged and are assigned the system-missing value<br />

in the new series.<br />

• A first-order lagged series can also be created using COMPUTE. COMPUTE does not cause<br />

a data pass (see COMPUTE).<br />

Table 1 First-order lag and lead of series X<br />

X Lag Lead<br />

198 . 220<br />

220 198 305<br />

305 220 470<br />

470 305 .<br />

Example<br />

CREATE LAGVAR2 TO LAGVAR5 = LAG(VARA,2,5).<br />

• Four new variables are created based on lags on VARA. LAGVAR2 is VARA lagged two<br />

steps, LAGVAR3 is VARA lagged three steps, LAGVAR4 is VARA lagged four steps, and<br />

LAGVAR5 is VARA lagged five steps.<br />

LEAD Function<br />

LEAD creates new series by copying the values of the existing series and moving them back<br />

the specified number of observations. This number is called the lead order. Table 1 shows a<br />

first-order lead for a hypothetical data set.<br />

• The specification on LEAD is the name or names of the existing series and one or two lead<br />

orders, in parentheses.<br />

• At least one lead order must be specified; there is no default.

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

Saved successfully!

Ooh no, something went wrong!