There are two ways to answer this question. We could use the summarize command with qualifiers to produce the answer, although this would take many lines of syntax and would take some time to work through. A quicker and more effective way to answer the question above is to use the sum option with the tabulate command.
tabulate location, sum(age)
location of | Summary of age of respondent
household | Mean Std. Dev. Freq.
------------+------------------------------------
Urban | 23.750553 15.620933 1808
Urban Vil | 23.266964 19.240911 2019
Rural | 25.372664 21.554604 3907
------------+------------------------------------
Total | 24.443755 19.728498 7734
We obtain the table above, which provides us with the mean age for each of the three locations (urban, urban villages, and rural).