I am still struggling with my current research. I want to run the following code in my panel data set:
Code:
tsset ID year
forval i = 1/2 if varX == 1 {
forval t = Year if varX == 1 {
noisily synth varA varB, trunit(`i') trperiod
(`t') }
| Id | year | VarX | VarA | VarB |
| 1 | 2002 | 0 | 0.1234 | ... |
| 1 | 2003 | 1 | 0.1234 | ... |
| 1 | 2003 | 0 | 0.1234 | ... |
| 2 | 2002 | 0 | 0.1234 | ... |
| 2 | 2003 | 0 | 0.1234 | ... |
| 2 | 2004 | 1 | 0.1234 | ... |
My objective: I want to run the synth for all IDs (
`i')
that have a VarX with 1 and for the respective year
(`t')
.Thank you.
Konstantin
0 Response to Forval loops with if-conditions in Panel data
Post a Comment