Hello together.

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') }
The data look like this:
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 ...
The synth-code itself works perfectly by hand. The problem is the second loop and and "if" -condition.

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