Hi! I'm trying to construct the variables for exporter-time and importer-time fixed effects for our gravity model but I only get the error 'invalid syntax' r(198). I simply copied the Stata commands from the book by Yotov et al. (2016) but there seems to be a problem that I can't resolve. Thank you all for your help in advance. Your feedback will be a big help to our research. Here are the codes I used:
describe IMPORTER_TIME_FE*
global N = r(r)
global N_1 = $N - 1
forvalues i = 1 (1) $N_1 {
replace EXPORTER_TIME_FE`i' = EXPORTER_TIME_FE`i' * exp(_b[EXPORTER_TIME_FE`i'])
replace IMPORTER_TIME_FE`i' = IMPORTER_TIME_FE`i' * exp(_b[IMPORTER_TIME_FE`i'])
}
replace EXPORTER_TIME_FE$N = EXPORTER_TIME_FE$N * exp(_b[EXPORTER_TIME_FE$N ])
replace IMPORTER_TIME_FE$N = IMPORTER_TIME_FE$N * exp(0)
egen exp_pi_BLN = rowtotal(EXPORTER_TIME_FE1-EXPORTER_TIME_FE$N)
egen exp_chi_BLN = rowtotal(IMPORTER_TIME_FE1-IMPORTER_TIME_FE$N)
The error appears when I run the forvalues command:
. forvalues i = 1 (1) $N_1 {
2. replace EXPORTER_TIME_FE`i' = EXPORTER_TIME_FE`i' * exp(_b[EXPORTER_TIME_FE`i'])
3. replace IMPORTER_TIME_FE`i' = IMPORTER_TIME_FE`i' * exp(_b[IMPORTER_TIME_FE`i'])
4. }
invalid syntax
r(198);
0 Response to Problem with macro in forvalues
Post a Comment