SHAZAM Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
  • Program to create moving sums of a variable sample 1 10
  • generate some simple data to make it easy to check genr x=time(0)
  • initialize the moving sum variable genr msum=0
  • add up the number of lags (this example does current plus last 2)
  • if you dont like output, you can SET NODOECHO after it works do #=0,2 genr msum=msum+lag(x,#) endo
  • print it out, the first few observation will be garbage print x msum stop
  • * Program to create moving sums of a variable
    sample 1 10
  • 10 * generate some simple data to make it easy to check genr x=time(0)
  • x=time(0) * initialize the moving sum variable genr msum=0
  • msum=0 * add up the number of lags (this example does current plus last 2)
  • 2) * if you dont like output, you can SET NODOECHO after it works do #=0,2 genr msum=msum+lag(x,#) endo
  • endo * print it out, the first few observation will be garbage print x msum stop
  • stop