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
Help for data with multiple quarterly observationsHello and sorry if this question is obvious or incorrect, I have quarterly data from 2007q1 to 2010…
Question on looping over files in a directory using local and foreachDear Statalists, Recently I am attempting to deal with some .dta files in a local directory on the …
Reshaping the Bruegel DatasetGood Day! I am currently trying to reshape the Bruegel Dataset. Currently it is comprised of a year…
replacing "X" character within a string variable with "9"Hi, I have a string variable that some of its values consist of a combination of numbers and "X" (e.…
Labels at scatter plotDear All, I am always fascinated seeing how much useful information can be derived from even the si…
Subscribe to:
Post Comments (Atom)
0 Response to egen with conditions
Post a Comment