Generate lags, leads, and differences (STB-7: sts2) ------------------------------------- ^lag^ [#] varname [^, s^uffix^(^str^)^] ^lead^ [#] varname [^, s^uffix^(^str^)^] ^dif^ [#] varname [^, s^uffix^(^str^)^] Description ----------- ^lag^ generates the lags of varname. # specifies the number of lags to be gen- erated and 1 is assumed if # is not specified. "^lag 2 gnp^" creates ^L.gnp^ and ^L2.gnp^. ^lead^ generates leads of varname. # specifies the number of leads to be gen- erated and 1 is assumed if # is not specified. "^lead 2 gnp^" creates ^F.gnp^ and ^F2.gnp^. Description, continued ---------------------- In either case, # may be specified as negative, in which case ^lag^ produces leads and ^lead^ produces lags. # may be specified as 0, in which case ^lag^ and ^lead^ do nothing. ^dif^ generates the #th difference of varname. "^dif gnp^" creates ^D.gnp^. "^dif 2 gnp^" creates ^D2.gnp^, the difference in the difference, but does not create ^D.gnp^. # must be greater than or equal to 0; if # is 0, ^dif^ does nothing. Options ------- ^suffix(^str^)^ specifies the base part of the name to be used rather than the existing name. E.g., "^lag 2 gnp, suffix(x)^" creates variables named ^L.x^ and ^L2.x^ rather than naming the variables ^L.gnp^ and ^L2.gnp^. Examples -------- . ^lag gnp^ . ^lag 2 gnp^ . ^lag 4 gnp^ . ^lag -2 gnp^ . ^lead 2 gnp^ . ^dif gnp^ . ^dif 2 gnp^ Remarks ------- "^lag gnp^" creates ^L.gnp^. "^lag 2 gnp^" creates ^L.gnp^ and ^L2.gnp^. Therefore, you may reason that you cannot type "^lag 2 gnp^" after "^lag gnp^" because the variable ^L.gnp^ already exists. You may, however. Operators may be applied to results of other operators, for instance: Remarks, continued ------------------ . ^dif gnp^ . ^lag D.gnp^ The resulting variable is ^LD.gnp^. However, the routines are not smart about combining names: . ^lag gnp^ . ^lag L.gnp^ creates a variable named ^LL.gnp^, not ^L2.gnp^. Also note that . ^lag gnp^ . ^lead L.gnp^ produces ^FD.gnp^, which is not quite identical to ^gnp^ because the last observa- tion will be missing. Author ------ Sean Becketti, Federal Reserve Bank of Kansas City. Also see -------- STB: sts2 (STB-7) On-line: ^help^ for ^dropoper^, ^growth^