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
Calculate median with conditionsI want to calculate the median of a variable with certain restrictions. I know that -sum variable, d…
boxplotDear all, I have subdivided my particpants into 3 group based on bmi (0, 1, 2). i want to plot (box …
Use of repest for carrying out multilevel analysis with PIAACDear members of the list, I am trying to run a multilevel analysis using PIAAC data. Knowing the c…
Merging new variable conditioned on two other observationsHi people, I am currently working on a datasets that consists of customer booking information acros…
How to combine multiple gender variables to oneHello everyone, I am dealing with a somewhat complicated data that consists information about paren…
Subscribe to:
Post Comments (Atom)
0 Response to Sort
Post a Comment