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
Related Posts with egen with conditions
Collapsing time series data by geographyI have some data about social movements and it includes when social movements occurred. I'm trying t…
Error: no observations when running regressionsHello, I am trying to run some regressions and getting an error that says there are no observations,…
While using rangerun, change the order of items in a local macro containing variable list (dummies) at each iterationThe code below records coefficient estimates at each iteration. There are always two dummy variables…
Bayes Factors for t-testHi Listers, A reviewer has suggested presenting Bayes Factors. I am wondering how to do this after…
Bar graph, put bars in specific orderDear all, I produced a bar graph over income group, I'm trying to order the bars as lower-middle, u…
Subscribe to:
Post Comments (Atom)
0 Response to egen with conditions
Post a Comment