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
invalid syntax using cdfplotHi, I am using a user written command cdfplot in Stata 15 to generate normalized cdf by a categoric…
invariant regressorsDear all, I can't understand what's going on.. I have panel data and when i run BE in stata, indivi…
Identifying pairs of strings that differ by only two consecutive, inverted charactersI want to identify when two putatively matched surnames (stored as two string variables) differ only…
Preliminary analysis using latent variablesHello, I am running a mediation model where I plan to use two latent variables as mediators. For pr…
ivreg2h : (1) for panel data? (2) the same command for single equation and set of fully simultaneous equations?Dear Stata list members, I want to analyze a model using Lewbel's (2012) method of internal instrum…
Subscribe to:
Post Comments (Atom)
0 Response to egen with conditions
Post a Comment