Hello Statalist Folks,

I have the following annual public survey data where children are being counted by neighborhood in a Latin American City (there are more neighborhoods than listed but kept it short for the sake of the post). Each year there is a total provided of children under each age group and a var listing the year where the survey results came from. I am looking to get a few things from the following data:

1) Looking to find out the total number of 9 year olds part of the sample across all years analyzed (i.e. how many 9 year old children are counted for all years = 2001,2002, and so on..)
2) For a given year I am looking to find the total number of children ppart of the survey (i.e. in 2001 what is the sum of all the aages (9-17) across all cities)

Are there any recommendations you all have to get to these answer? What would be the codes needed to get there?

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte age int(DistritoNacional Azua Baoruco Barahona Dajabón Duarte ElíasPiña ElSeibo Espaillat Independencia Total year)
 9    .   2   1   1  .   8  .   .   3  .   50 2001
10   11   7   4   2  .   5  .   1   1  1  106 2001
11   24   2   3   3  .   8  1   .   1  .  173 2001
12   39  14   7   9  2  13  1   1   4  2  327 2001
13   98  27  10  30  2  29  5  14  13  4  783 2001
14  239  87  28  67  9  77  6  17  39  7 1968 2001
15  574 179  44 135 24 196 13  52  84 21 4183 2001
16 1030 260  79 236 29 284 31  83 136 37 7052 2001
17 1385 446  95 272 57 408 60  91 163 43 9651 2001
 9    .   3   3   1  .   4  .   .   .  .   45 2002
10   11   3   2   .  .   5  1   .   1  .   88 2002
11   23   8   2   5  2   4  .   2   1  .  128 2002
12   30  17   5  12  3  10  4   2   4  1  268 2002
13   84  37  15  25  3  27  5  14  16  2  623 2002
14  206  93  25  66  5  74  8  26  41  7 1677 2002
15  427 189  72 161 16 153 28  35 103 18 3393 2002
16  757 290 105 217 24 222 40  66 175 31 5577 2002
17 1068 399 146 322 35 258 62  81 239 49 7860 2002
 9    .   1   1   .  1   1  .   .   1  1   46 2003
10   11   4   3   3  1   3  .   1   2  2  123 2003
11   13   6   4   5  .   3  .   1   5  3  168 2003
12   41  21   4   8  1   4  3   4   6  .  368 2003
13   88  29  18  17  1  25  2  11  19  2  711 2003
14  235  93  33  58 10  51 14  22  54  8 1748 2003
15  538 196  42 128 20 107 31  38 134 19 3753 2003
16  951 294 103 162 37 177 37  95 193 26 6477 2003
17 1367 426 120 238 43 224 63 102 241 48 8852 2003
 9    .   7   1   3  .   2  .   .   4  2   69 2004
10    8  10   4   6  1   2  4   .   1  3  121 2004
11   23  13   3   4  .   2  3   2   1  5  173 2004
12   37  24  13   7  3   7  5   8   3  5  363 2004
13   78  28  15  30 11  26  8   9  20  7  797 2004
14  214 100  50  55 12  79 13  39  37 21 1882 2004
15  439 208  72 133 39 160 30  51 105 34 3704 2004
16  684 260 127 183 57 229 39  93 152 41 5476 2004
17  951 348 162 217 88 303 73 103 206 64 7691 2004
 9    .   3   2   .  1   3  .   .   .  .   42 2005
10   10   4   4   5  .   8  1   1   3  2  130 2005
11   15   9   5   3  2   5  2   5   3  6  191 2005
12   26  19   7   7  2  10  4   1   7  3  341 2005
13   83  35  20  30  8  24 13   7  15  8  776 2005
14  172  90  40  81 17  62 14  33  48 11 1820 2005
15  421 180  79 127 38 136 19  55 116 28 3644 2005
16  690 223 103 240 55 187 30  86 158 43 5337 2005
17  896 332 137 282 71 272 49  91 216 68 7244 2005
 9    4   4   3   .  1   1  .   .   1  .   58 2006
10   16   5   4   3  .   3  .   1   3  .   96 2006
11   12   7   4   3  .   3  .   1   8  3  144 2006
12   25  12   7  13  1   7  1   3   8  2  327 2006
13   74  33  25  28  3  25  4   7  19 12  710 2006
14  199  72  43  41 14  59  6  20  42 13 1643 2006
15  420 158  83 122 40 122 14  35 112 21 3485 2006
16  713 240  87 202 49 186 44  52 174 34 5245 2006
17  880 296 122 273 62 243 58  69 211 36 7058 2006
 9   13   4   2   .  1   3  3   .   .  .   79 2007
10   19   7   6   3  .   8  .   2   1  .  124 2007
11   23   4   8   6  .   6  2   5   2  1  162 2007
12   37  17   9  13  2  10  3   4   2  2  374 2007
13   73  39  20  22  9  29  8  16  18  3  823 2007
14  203  95  31  60 14  85 16  22  45 10 1953 2007
15  467 180  87 170 29 130 30  50  98 31 4061 2007
16  808 264 104 192 39 241 46  84 191 43 6355 2007
17 1176 349 157 255 58 308 57 112 217 50 8591 2007
 9   19   3   4   1  1   2  1   .   4  .   98 2008
10   26  12   7   3  .   1  1   3   1  .  139 2008
11   27  15   9   5  2   5  1   3   5  1  202 2008
12   43  25  17  17  1   6  5   3   6  .  395 2008
13   85  52  22  28  9  18  3   9  20  3  776 2008
14  216 107  49  80 10  34 12  19  37  8 1865 2008
15  558 188  79 154 24 106 22  41  74 10 3972 2008
16  930 292 128 221 41 164 43  53 160 27 6535 2008
17 1286 356 148 314 62 273 53  73 182 32 9088 2008
12   29  17  12  12  1   6  3   3   4  1  387 2009
13  102  45  33  32  6  15  7   9  12  9  901 2009
14  264  69  69  69 11  32 11  24  27  8 2013 2009
15  595 145 107 128 20  82 28  41  67 17 4207 2009
16 1115 239 145 199 39 155 43  56  92 44 6914 2009
17 1656 258 197 257 47 246 53  65 163 46 9483 2009
 9   16   3   .   .  1   .  1   2   .  1   71 2010
10   14   4   4   2  .   1  1   1   4  1  114 2010
11   18   8   8   6  3   6  1   1   2  1  173 2010
12   45  21  16  12  1   4  8   5   4  3  383 2010
13  111  28  36  19  3  16 10  14   9  6  868 2010
14  382  75  59  88  9  82 22  14  49  9 2334 2010
15  781 194 107 175 15 132 26  36  94 25 4735 2010
16 1271 261 132 188 27 221 42  88 127 45 7009 2010
17 1527 298 161 268 58 288 48  72 173 34 9324 2010
 9    1   1   .   1  .   2  1   .   2  1   39 2011
10    6   2   3   3  .   3  2   .   3  .   63 2011
11   17   4   5   9  1   2  2   2   2  .  147 2011
12   47  16  10  19  .  10  5   2  11  1  405 2011
13  159  47  42  47  5  38 14   9  30  . 1086 2011
14  386  93  55  91 13  61 20  29  45 14 2521 2011
15  804 179  89 183 31 160 44  39 117 22 4918 2011
16 1272 239  99 239 44 212 52  69 137 25 7343 2011
17 1765 265 132 295 67 253 68  81 205 37 9578 2011
 9    6   .   2   2  .   .  .   .   .  .   35 2012
10    2   1   3   2  .   .  1   .   .  1   67 2012
11   25   8   7   9  1   2  2   2   2  1  179 2012
12   48  16  12  19  4   9  8   2   4  2  391 2012
end