Hello everyone. I have a problem, I have a list of observations per year for each country. I want to know how many countries have at least two consecutive ovservations.
gen count=0
foreach var in country {
gen yearn`i'=0
foreach var in year {
if { year`i+1'==year`i'+1 }
yearn`i'=yearn`i'+1
}
if yearn`i'>=2
}
count = count+1
But it's an inexact syntax.
gen count=0
foreach var in country {
gen yearn`i'=0
foreach var in year {
if { year`i+1'==year`i'+1 }
yearn`i'=yearn`i'+1
}
if yearn`i'>=2
}
count = count+1
But it's an inexact syntax.
Comment