SHAZAM Questions and Answers (Q&A) - RSS feedhttp://community.econometrics.com/questions/SHAZAM Econometrics, Statistics and Analytics Communityen<font color="white">Copyright <b>SHAZAM Analytics, 2018</b></font>Thu, 25 Oct 2012 02:16:13 +0000How can I generate a variable that measures the change between X at time t and X at time t-1http://community.econometrics.com/question/247/how-can-i-generate-a-variable-that-measures-the-change-between-x-at-time-t-and-x-at-time-t-1/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)Wed, 24 Oct 2012 17:52:45 +0000http://community.econometrics.com/question/247/how-can-i-generate-a-variable-that-measures-the-change-between-x-at-time-t-and-x-at-time-t-1/Answer by Tenori for <p>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)</p>
http://community.econometrics.com/question/247/how-can-i-generate-a-variable-that-measures-the-change-between-x-at-time-t-and-x-at-time-t-1/?answer=334#post-id-334You 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.Thu, 25 Oct 2012 02:16:13 +0000http://community.econometrics.com/question/247/how-can-i-generate-a-variable-that-measures-the-change-between-x-at-time-t-and-x-at-time-t-1/?answer=334#post-id-334