Hello
I am using the loop function for some simple merges of 5 datasets.
I did it before and it worked. now to redo it again I faced with" too many variables defined" error. Does anyone help me?
my syntax is:
forvalues loop=2002/2016{
clear
use "\\...................\F`loop'.dta",
gen local z=`loop'-1
merge 1:1 Id using "\\..................\G`z'.dta"
keep if _merge==3
drop _merge
save "\\...........................\Cohort`z'.dta", replace
}
Related Posts with Too many variables in loop
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…
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 …
Calculate % coefficient effect after regressionHey everybody, I have a regression: Code: xtreg IMD ulc GDPpc capitalform mor sen pop pat fd van_i…
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 …
Subscribe to:
Post Comments (Atom)
0 Response to Too many variables in loop
Post a Comment