Hi, I'm trying to calculate HHI indexes starting from a tab command.
Manually, I just grab the percentages and put them in the new variable; but I wonder if there is a way to automate the process. In my data I have to do this 40 times (I have 2 sectors and 20 regions)!
Manually, I just grab the percentages and put them in the new variable; but I wonder if there is a way to automate the process. In my data I have to do this 40 times (I have 2 sectors and 20 regions)!
Code:
sysuse auto tab foreign gen hhi=70.27^2 + 29.73^2 sum hhi
Comment