to calculate a cross sectional average of the variable ff, I have used:
egen ave_ff =mean(ff), by(month)
but I am hoping someone could help me include an if qualifier so that I only average the observations not containing the dummy variable dum
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float month long id float(ff dum) 664 2708 -.0018369863 0 665 2708 -.00494564 0 666 2708 -.009506066 0 664 2745 .00530777 0 665 2745 -.05659205 0 666 2745 -.0013513556 0 664 3946 .011887698 1 665 3946 .020265907 1 666 3946 .00999126 1 end format %tmYYMon month
0 Response to how to include an if qualifier in an egen command mean() function
Post a Comment