Hi, Stata people.
I have got a 20 years panel data 1990- 2010. For the falsification test. I drop all the treated variables and I randomly want to assign treatment to same no of observation as it was in year x .
So far I am manually doing the work. The toy story is :
[generate random= uniform() // generating random values
sort year random // sorting the random value by year as I have to assign same no treatment as it was in year X
gen treat =0 now I am generating the treatment variable treat
replace treat =1 in 1/5 // as the years are sorted. I am manually looking into the year and in the year 1990 (which runs from cell 1 to 25), only 5 was treated
replace treat =1 in 26/30 // again in 1991 5 was treated, 1991 year cell runs from 26 to 45
][/CODE]
Can anyone help me how to go about it rather than looking at the cell for the year range and then assigning the n observation.
Any help is appreciated.
Related Posts with Panel data : assigning random treatment to same no of observation yearwise
Stata tables to word format by writing matrix commandHi. I am using a dataset that has 3 years. I am using the command tabulate to do analysis. So I am w…
RDRobust QuestionHi all, I am trying to use a fuzzy regression discontinuity strategy in some data work of mine. I h…
Probit QuestionHi all, If I have a panel of people from ages 25-30, who I may observe more than once in these ages…
I use qreg, then margins, then mplotoffset: how do I change the spacing for my y-axis?Hi Stata community, I want to change the spacing for my y-axis. Currently I have 0.5 cm between one…
Custom STS graph axis with spacingHi, This is my first post on STATALIST I am trying to create a custom y axis scale using Sts graph…
Subscribe to:
Post Comments (Atom)
0 Response to Panel data : assigning random treatment to same no of observation yearwise
Post a Comment