Hi,

I am trying to do the following. The command inequal7 is able to give various inequality measures for a sample. Now suppose that in my sample I make a distinction between low/medium/high education (0/1/2) and whether a person is married or not (0/1). The unit of observation is the individual. For a particular composite measure, I need to calculate the Mean Log Deviation (given by command inequal7 and stored in r(mld)) for each combination of education and married (so six in total). Once I have the six MLD values for each of the combinations, I need to take the weighted average to generate the final measure. As an example, medium education and married may occur 500 times in the dataset, while highly educated and not married may occur 200 times. I can manually calculate it using an IF statement, but if the set of combinations becomes really large, this becomes very time-consuming. Is there perhaps an easier solution to this?

Cheers.