SHAZAM Community
Ask Your Question
0

How can I generate a variable that measures the change between X at time t and X at time t-1

asked 2012-10-24 17:52:45 +0000

DocJay gravatar image

I'm looking to generate a variable that measures the difference in a variable over time, of variable PIt, such that DINFL= PIt-PI(t-1)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2012-10-25 02:16:13 +0000

Tenori gravatar image

updated 2014-01-16 11:09:34 +0000

You could do

GENR LAGX = LAG(X)
GENR DIFFX = X-LAGX

Note that the Lag of X doesn't exist for the first observation so a WARNING is printed.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2012-10-24 17:52:45 +0000

Seen: 3,799 times

Last updated: Jan 16 '14