Question & Answer
Question
I wish to compute new variables in SPSS Statistics with the LAG and LEAD functions. (LAG(X) uses the value of X from the previous case while Lead(X) uses the value of X from the following case.) I would like to specify a variable name (e.g. CUSTLAG), rather than an integer, as the span of cases to lag or lead, so that a different span size is used for each case. For the CREATE and SHIFT VALUES commands, if one wants to use a LAG() or LEAD() function, the second argument must be an integer. The same is true for the lag function in the COMPUTE command. How can I apply such a function in SPSS Statistics? Would a VECTOR and LOOP or DO REPEAT structure be required?
Log InLog in to view more of this document
Was this topic helpful?
Document Information
Modified date:
16 April 2020
UID
swg21645129