Dear Stata Forum,

I have a panel data with several groups. Year and ID with three variables : variable_1 (dummy), variable_2 (continuous) and variable_3(dummy).

I have been using the following egen command to compute aggregates without missing values:

bys year: egen var_sum = sum(cond( variable_1 == 1, variable_2, .))

My question is whether it is possible to include more conditions in the above syntax as I want to compute aggregates in the intersection of vairable_1 and variable_3.

Thank you.

Best wishes,
Manish