Hi everyone,
I am getting an error in the loop creation and cannot identify why. Any suggestions would be very appreciated.
use "treated_firms.dta", replace
*Loop for 1974-1980, 1980-1983, 1983-1985
forvalues i = 1/3 {
keep if compare == `i'
global N=_N
forvalue ipocompany = 1/$N {
use "treated_firms.dta", replace
keep if _n==`n'
display `n'
joinby m:m siccd3 date using "control_firms.dta"
keep if _merge == 3
drop _merge
compress
if _N!=0 {
gen n_dist = ((ipo_price_ct - ipo_price_tr)^2)
sort n_dist
keep if _n == 1
drop n_dist_1
}
if `n' > 1 {
append using matched_pairs.dta, nolabel
}
save "matched_pairs.dta", replace
}
}
restore
Thank you !
Related Posts with Syntax error in loop creation
Create new variable using coefficient from a variable containing time dummyHello everyone, I'm using Stata version 14.0. I'm actually trying to estimate the natural rate of un…
Regress in fixed time periodI have a dataset from 2004-2022 and want to form a regression every rolling 6 months so jan 2004-jun…
Weights not workingHi everyone, I've been trying to run a regression analysis with weights, but Stata keeps telling me…
converting modate format string to numericDear All, I have the data which is in the following format. The modate is in string format. The dat…
How to fix when option is not allowed (r198)?Hello, I am currently using Stata/SE14.1 and I simply tried the following codes metan ln_HR ln_LCI …
Subscribe to:
Post Comments (Atom)
0 Response to Syntax error in loop creation
Post a Comment