Hey people,

I want to run a regression with Stata and must change a few variables. There are three variables (v274, v276, v281) I want to merge into one variable (typeofearner). The data is survey data from a German survey organization. German citizens were interviewed. I use data from 1991 to 2011 (one survey per year) which I want to merge at the end for the regression.

V274 is an ordinal variable, that presents the graduation level.
V276 is a categorical variable, that present if the respondent has a state examination or not.
V281 is a categorical variable, that indicates what occupation the respondent has.

What I want to create is a categorical variable, that has one category „high earners “(people with high wage) and “low earners” (people with less wage).
Into “high earners” belonging people with high graduation level, with state examination and such occupations (e.g. judge).
The rest logically belongs to low earners.

At the end I want to run a regression with this as the independent variable and a variable that indicates if immigration is a big problem or not for the respondent. My aim is to investigate possible differences between high/low earners in their view on immigration.

I used to merge the variables with “replace” but I’m unsure if this is the right way to do it since there so many commands to combine data.
I recoded the missings but did not touched them further.

Thanks in advance.



Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte(v6 v274 v276 v281) float typeofearner
17 3 .  . 1
17 2 .  2 1
 9 4 1  . 2
 9 3 .  . 1
 9 3 .  4 1
 9 4 1  8 2
17 2 .  2 1
 1 4 1  8 2
32 3 . 14 1
13 2 . 14 1
 9 2 .  . 1
 9 3 .  5 1
32 4 1  7 2
 9 4 2  4 2
 2 4 1  4 2
 4 3 .  5 1
 9 3 .  . 1
 9 3 .  3 1
 9 2 .  3 1
 9 3 .  4 1
 9 3 .  5 1
 9 4 1  5 2
 9 4 1  5 2
 2 4 2 14 2
 9 2 .  . 1
 9 3 .  5 1
18 2 .  . 1
 9 3 .  4 1
 9 3 . 14 1
 9 3 .  8 1
 2 3 .  5 1
 9 3 .  6 1
 4 2 .  . 1
 1 2 .  4 1
32 4 2  . 2
 9 2 .  3 1
 9 2 .  5 1
 9 2 .  2 1
 2 2 .  6 1
 9 2 . 14 1
 9 3 .  3 1
14 3 .  3 1
 9 2 .  2 1
 9 4 1  5 2
 4 4 1  8 2
 2 3 .  2 1
13 3 .  4 1
 9 2 .  7 1
 9 4 2  4 2
 9 4 1  . 2
 9 3 .  3 1
 2 3 .  4 1
18 3 .  5 1
 9 4 2  4 2
 9 4 2  4 2
 9 2 .  4 1
 9 2 .  4 1
 9 2 .  4 1
 9 2 .  . 1
 9 4 2  7 2
 9 2 .  2 1
 6 3 .  4 1
20 3 .  . 1
32 3 . 14 1
 1 3 .  4 1
18 3 .  4 1
 9 2 .  5 1
 9 3 .  5 1
13 4 2 15 2
 9 3 . 14 1
 2 3 .  5 1
 9 2 .  . 1
 9 4 2  4 2
 9 4 2  . 2
18 3 .  . 1
13 2 .  2 1
 9 3 .  . 1
 9 3 .  4 1
 9 4 2 14 2
30 2 .  3 1
 9 2 .  2 1
17 3 .  . 1
 8 2 .  3 1
 9 2 .  5 1
 7 3 . 14 1
 9 2 .  5 1
 9 4 2  . 2
 9 2 .  2 1
 9 3 . 14 1
 7 2 . 15 1
 7 2 .  6 1
 9 2 .  1 1
 9 3 .  7 1
 9 2 .  3 1
13 3 .  . 1
 9 2 .  1 1
 9 2 .  5 1
 2 1 .  4 1
 2 3 .  4 1
 9 2 .  . 1
end
label values v274 V274
label def V274 1 "kein Hauptschulabschlu�", modify
label def V274 2 "Hauptschulabschlu�", modify
label def V274 3 "Mittelschulabschlu�", modify
label def V274 4 "Abitur Hochschulreife", modify
label values v276 V276
label def V276 1 "ja", modify
label def V276 2 "nein", modify
label values v281 V281
label def V281 1 "ungelernt", modify
label def V281 2 "Facharbeiter Meister", modify
label def V281 3 "einfache T�tigkeit", modify
label def V281 4 "gehobene T�tigkeit", modify
label def V281 5 "leitende T�tigkeit", modify
label def V281 6 "Beamte einfacher Dienst", modify
label def V281 7 "Beamte mittlerer Dienst", modify
label def V281 8 "Beamte gehobener Dienst", modify
label def V281 14 "Selbst�ndig", modify
label def V281 15 "Landwirt in  selbst�ndig", modify
------------------ copy up to and including the previous line ------------------