Hi
In my dataset I have yearly variable, from 1995 to 2006 and a treatment happening in year 2003. I want to estimate the placebo effect ( that requires a me to generate random fake dummies) then estimate the estimate the difference in difference (DID regression) using all of the randomly generated placebo dummies and I need to store the DID coefficients and take the average of their effect. So in a first step I need to use loop to generate dummies. So I would need my loop outcome total number of dummies that is equal to 14 years (total number of years -2= 16-2). Therefore the first dummy would take on the value of 1 from 2000 and onwards, the second dummy will take the value of 1 in 2001 and zero otherwise, the third dummy would take on the value of 1 in 2002 and zero otherwise... etc. In or to generate this, I used the following loop code
[/
levels of x, local(year) foreach lev of local year {
gen x_`lev'=0 replace x_`lev'=1 if year>x("`lev'") } ]

When I run this loop, I do not get any output in my dataset. Any idea what is wrong in my code ? Many thanks