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
Metafunnel command - studies not displayed as expectedHi I'm using metafunnel in Stata 15.1 to plot funnel plots for a meta-analysis I'm undertaking but …
Exploring Stata mapping toolkitDear All, I want to visualise trade data showing the links between regions. Something like this (won…
VECM: questions on Rank and First-difference vs. LevelDear all I am using VECM for the first time so please apologise me if my questions are so basic. I …
Creating a year variable in a longitudinal datasetHi All My dataset is longitudinal in the long format, and each individual has 5 rows of data with e…
Calculate % coefficient effect after regressionHey everybody, I have a regression: Code: xtreg IMD ulc GDPpc capitalform mor sen pop pat fd van_i…
Subscribe to:
Post Comments (Atom)
0 Response to Syntax error in loop creation
Post a Comment