Hello Statalist,

I think I overthinking a rather simple problem with creating a new variable and I thought I post on the forum for some help.

I want to recode some variables for a regression analysis. I have 3 variables for education level edu_hs, edu_hsplus, edu_college. Each variable represents the number of people in a county that has a high school education across multiple years. I want to recode them into edu_all where 1 = edu_hs, 2= edu_hsplus, and 3=college. Not sure if i am conceptualizing it correctly. I also want to apply this logic to following variables gender (male and female are vars), race (each race category is a separate var), age (age groups are separate var).

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int year float(n_county edu_college edu_hs edu_hsplus race_aian race_asian race_black race_latino) long(popfemale popmale)
12 1  8721  4528  31629  337  566 10116 1274  28461  27053
13 1  8721  4528  31629  329  628 10095 1330  28450  26796
14 1  8721  4528  31629  331  603 10245 1364  28452  26943
15 1  8721  4528  31629  322  664 10493 1417  28490  26857
16 1  8721  4528  31629  325  632 10556 1336  28422  26994
12 2 41289 13956 125758 1524 1548 17977 8174  97755  93035
13 2 41289 13956 125758 1571 1729 18341 8395 100053  95487
14 2 41289 13956 125758 1616 1817 18802 8571 102514  97597
15 2 41289 13956 125758 1628 1907 19088 8709 104423  99286
16 2 41289 13956 125758 1732 2242 18860 8630 107322 101241
12 3  2366  4824  13563  231  122 12756 1229  12599  14602
13 3  2366  4824  13563  209  142 12765 1174  12594  14482
14 3  2366  4824  13563  206  132 12689 1091  12533  14354
15 3  2366  4824  13563  202  118 12529 1044  12341  14148
16 3  2366  4824  13563  209  117 12337  966  12186  13779
12 4  1885  3040  12705  112   31  4994  418  10402  12195
13 4  1885  3040  12705  119   35  4956  421  10354  12158
14 4  1885  3040  12705  124   50  4931  424  10338  12168
15 4  1885  3040  12705  127   52  4980  492  10413  12170
16 4  1885  3040  12705  113   45  4895  521  10498  12145
end
label values n_county n_county
label def n_county 1 "ALABAMA Autauga", modify
label def n_county 2 "ALABAMA Baldwin", modify
label def n_county 3 "ALABAMA Barbour", modify
label def n_county 4 "ALABAMA Bibb", modify