Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • consecutive ovservations

    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.

  • #2
    Hey Foudil, this is the Mata forum, general Stata questions should be posted in http://www.statalist.org/forums/foru...ussion/general, where you have a much higher chance of getting a response.

    Comment

    Working...
    X