Hello,

I would like to calculate the employment and unemployment rate using estimates of labor force, # of employed, and # of unemployed.

Below is a part of my dataset. I renamed the variables in a consistent matter so that I start with 'laborforce', 'employed', and 'unemployed'.

Is there a way where I can simplify the code to calculate the total labor force, total # of employed, and total # of unemployed?

I could do it manually, but I was wondering if there is a method to add them at once.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int(laborforce_male_16_19 employed_male_16_19 unemployed_male_16_19 laborforce_male_20_21 employed_male_20_21 unemployed_male_20_21 laborforce_male_22_24 employed_male_22_24 unemployed_male_22_24 laborforce_male_25_29)
 19  19  0  41  41  0  13  13  0  71
 94  93  1   0   0  0 121 105 16  21
  1   0  1   0   0  0  25  25  0   1
 27  10 17  12  12  0  61  61  0   9
 47  25 22   0   0  0  40  40  0  27
  0   0  0   0   0  0  17  17  0  14
 19  19  0   0   0  0   0   0  0  24
 31  31  0  15  15  0  55  55  0  72
 30  19  0  19  19  0  19  19  0  45
  0   0  0   0   0  0  24  24  0  82
 56  23 33  23  23  0  42  42  0  78
 31  31  0  40  12 28  37  37  0  90
 59  59  0  35   0 35 286 286  0 133
 19  19  0   7   7  0  55  40 15  64
  8   0  8  13  13  0  16  16  0  44
 12  12  0  14  14  0  27  27  0  24
  0   0  0  18  18  0 104 104  0  60
 14  14  0  38  30  8  50  50  0 120
 15   6  9  14  14  0  15  15  0  87
 12  12  0   0   0  0  18  18  0   5
 34  34  0   0   0  0  91  91  0  12
 13  13  0  29   0 29 126 126  0 171
 48  48  0   0   0  0  65  65  0  98
 62  62  0   0   0  0 116 101 15 192
  0   0  0   0   0  0  53  53  0 182
  0   0  0  22  22  0 122 122  0  54
 92  35 57  16  16  0  10  10  0  72
  7   7  0  71  13 58  71  63  8  68
 50  50  0  35  35  0  57  36 21 351
 71  71  0   0   0  0 133 133  0 119
 47  47  0   0   0  0  14  14  0  90
 53  53  0  39  39  0  17  17  0  96
  8   8  0   0   0  0  34  34  0  42
  0   0  0  90  90  0  56  31 25 196
 53  53  0  39  39  0  63  63  0  33
173 161 12  13  13  0 111 111  0  63
 21  13  8   0   0  0  29  14 15  69
 59  28 31  52  52  0 155 154  1  86
 78  78  0 134 134  0 125 125  0 126
 35  35  0  54  54  0 103 103  0  77
 50  50  0  37  37  0  68  50  0 134
 24  24  0  44  44  0 132 132  0  96
109  95 14 125 125  0  89  89  0  41
  0   0  0  17   0  0  89   0  0  86
 11  11  0   0   0  0   9   9  0 114
 42  42  0   0   0  0  64  64  0  62
186 186  0   0   0  0  97  64 33  89
 35  35  0 106  67 39  12  12  0  82
 31  31  0   0   0  0  56  56  0  56
 39  28 11   0   0  0  24  24  0  71
  0   0  0   0   0  0   0   0  0  10
 71  71  0  45  33 12  99  99  0 109
  9   9  0   0   0  0  11  11  0 167
 71  53 18   0   0  0  13  13  0 197
  0   0  0  12  12  0  11  11  0   0
 27  27  0   0   0  0  33   0 33  49
  0   0  0   0   0  0   0   0  0   0
 49  25 24  21  21  0  41  41  0 107
  6   6  0  54  54  0  41  41  0 163
 13  12  1   6   5  1  98  98  0  71
 57  57  0  25  25  0  12  12  0  55
 47  11 36  26  26  0  14  14  0  33
 44  23 21  23  23  0  25  12 13 120
 29  29  0  39  25 14  43  26 17  41
 33  19 14  42  42  0  62  42 20  41
end
I was thinking of codes like (which does not work):
Code:
egen laborforce = sum(labor force*)
egen employed = sum(employed*)
egen unemployed = sum(unemployed*)
Thank you very much in advance!!