Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: looping when i jumps


From   Rashmi Shankar <[email protected]>
To   [email protected]
Subject   Re: st: RE: looping when i jumps
Date   Tue, 28 Jun 2005 10:20:03 -0400

*granger causality


set more off
tsset cnum obs_number , format(%tq)

local vari  "lnpetrol lnchinaimp"
foreach y of num 1/56 {
foreach x of local vari {
disp `y'
var bp_level `x' if cnum==`y' , lags(1/4)
vargranger
}
}

**1st differenced
foreach y of num 1/56 {
foreach x of local vari {
gen d`x' = `x'-`x'[_n-1]
disp `y'
var dbp_level d`x' if cnum==`y' , lags(1/4)
vargranger
drop d`x'
}
}
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index