Hi,

I have tried to store the coefficient of the vec results.

The code I used is as below.

Code:
use data_file, clear
levelsof id, local(id)
gen coefficient1 = .
gen coefficient2 = .
sort id date
by id: gen time = _n
xtset id time
foreach c of local id {
    vec d.id d.x1 d.x2, lags(5), if id == `c' 
    replace coefficient1 = _b[x1] if id == `c'
    replace coefficient2 = _b[x2] if id == `c'
}
The result indicates
[x1] not found

I am not sure what to put inside _b[x1], could someone kindly suggest please?