I think this is a simple question. I have a categorical variable (85 departments) in a long data set with multiple years/department. I use by, sort, & egen to calculate the % male in each department. However, I only want to use 1 year. How do I code that?
Right now I have
by department female, sort: generate male = _N
by department: generate percentmale = 100 * male / _N
thank you...
Related Posts with Sort
continuous interaction variable and marginsaa …
Creating an Abortion scaleHello Everyone, I am trying to create a 7-point scale for attitudes towards abortion for every dec…
Interpret log-linear coefficient of a percentage typeExtremely trivial question but I just want to ensure I have the right interpretation. I have the fo…
Stata 18 and StatalistWith the most welcome release of Stata 18, the FAQ Advice has as is customary been tweaked slightly.…
how to calculate output of r(alpha) (short example included)?My deepest apologies if this is difficult to work with. I'm not a stata user, i'm just trying to dec…
Subscribe to:
Post Comments (Atom)
0 Response to Sort
Post a Comment