Greetings,

I'm running Stata 15.1 on OSX. My ultimate goal is to create a graph that displays the age-adjusted median incomes for different European ethnic groups. I know how to create a simple median income variable by group (egen medincome_group=median(inctot), by(ancestgroup)), but I'm not sure how to create one that adjusts for the effects of age differences. Can anyone point me in the right direction?

​​​​​​Here is some example data:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long inctot float ancestgroup
184000 10
  7200 10
 24000  3
 43000  1
 52000 10
 38900 21
     .  5
135000  8
 13000  2
     . 10
 60000  6
 40000 10
 15000  5
103620  2
 34500  3
 50000  3
 42000 10
 17400 17
 79000  5
     .  9
     .  3
 49700 21
     . 15
 13800  5
 39000  3
     0  5
 25000  5
 27500  5
   190  5
 34800  5
 81100  3
 45700  5
  1310  2
 36000  5
 80900 10
     0  3
 37000 11
     0 10
 24400 15
 60000  1
     .  5
     .  5
 25000  3
 74000  5
 41000  2
 30000  9
 32000  5
  6000 14
 32600  1
 25000  3
 10000  1
 26000  5
148000  1
 47200 10
 14000  3
 28000  8
 43600  3
 70900  1
     0  3
 55000  9
     0 10
 25000 42
     .  5
 75000  5
 50000  5
 68000 10
 10800  5
 60030 21
 26100  1
 11200  1
 30000  6
406000  2
 92900  1
  5300 14
  4500  2
110600  3
 70000  2
130000 10
 15090 10
 40000 19
 25000  5
  8700  5
 50000 14
 36000 21
 16000  9
 17000  5
     .  3
 10000  5
 29800  5
     0  2
  7300  5
425300 21
 50000  5
 45000  5
 16800  1
  7200  5
 10000  1
126000  5
 34000  8
 14800  5
end
label values ancestgroup ethnic1b
label def ethnic1b 1 "British/English", modify
label def ethnic1b 2 "Scottish", modify
label def ethnic1b 3 "Irish", modify
label def ethnic1b 5 "German", modify
label def ethnic1b 6 "Dutch", modify
label def ethnic1b 8 "Russian", modify
label def ethnic1b 9 "French", modify
label def ethnic1b 10 "Italian", modify
label def ethnic1b 11 "Greek", modify
label def ethnic1b 14 "Swedish", modify
label def ethnic1b 15 "Norweigan", modify
label def ethnic1b 17 "Hungarian", modify
label def ethnic1b 19 "Czech", modify
label def ethnic1b 21 "Polish", modify
label def ethnic1b 42 "Yugoslavian", modify
Thanks in advance for your help!