Good day all of you!

I have a Diff-in-Diff model that I need help with.

I want to estimate the average effect of Banco Azteca's shock of microcredit on the average household's income in Perú. For context, in 2008 Banco Azteca entered in Perú with 120 agencies around the country. I have survey data of annual household's gross income from 2004 to 2011 (4 years after and 4 years before Azteca entered). Also I have data of the number of districts in which Azteca had an office between the years 2008 and 2011. Notice that not all the districts with Azteca (treatment group) were the same throughout the years, for example, Miraflores-Lima-Lima had one or more Azteca agencies for the four year post-period, but Castilla-Piura-Piura had one agency from 2008 to 2010 and zero in 2011.

First our code looked like this:

areg lingp time treat azteca i.year, a(ubigeo) vce (cluster ubigeo)

Where linp means the logarithmic average household's income per cápita, time was a dummy of time with value of 1 (if the year was 2008 or higher) and 0 (if the year was 2007 or lower), treat was a dummy of treatment with value of 1 ( if the household distric had an Azteca i any given time) and 0 (if the household distric didn't had an Azteca in any given time), azteca was an interaction between time and treat, i.year were dummies of year and ubigeo was the code of the district.

Researching more we found that the original equation was wrong and we needed a generalized DD. So our new code was:

areg lingp azteca2 i.year, a(ubigeo) vce (cluster ubigeo)

Azteca2 being a dummy with value of 1 if at certain year a distric had an Azteca and zero if not. For example, in the example above in 2008 a certain person who lived in Castilla would have had an azteca2 value of 1, but in 2010 a person living in Castilla would have had an azteca2 value of 0.

Also we did this:

areg lingp azteca2 i.year i. ubigeo##trend, a(ubigeo) vce (cluster ubigeo)

Where trend accounts for the years of the time period, being 1 if the year is 2004, 2 if the year is 2005, 3 if the year is 2006, 4 if the year is 2007, 5 if the year is 2008, 6 if the year is 2009, 7 if the year is 2010 and 8 if the year is 2011.

I wanted to know if these codes were correct or if they lack something. Every help would be appreciated.

You have my gratitude in advance.