Hi everyone,

I would like to test an unbalanced panel for unit roots and store the results by group. Currently my approach is like this

Code:
egen group = group(gvkey)
su group, meanonly
capture postutil clear
postfile handle int group float zt pvalue using dfuller_results, replace
forvalues i = 1/`r(max)' {
    capture dfuller sent_neg if group == `i'
    post handle (`i') (`r(Zt)') (`r(p)')
}
Date looks like this

sent_neg gvkey
5 1045
0 1045
2 1045
3 1045
2 1045
3 1045
6 1046
6 1046
1 1046
2 1046
6 1046
5 1046
3 1046


But unfortunately I receive an "invalid syntax" error.

Any idea what the issue might be?

I followed instructions by Clyde Schechter in this thread https://www.statalist.org/forums/for...-panel-results

Any help is much appreciated!

Thanks and best,
Micha