Dear Forum,
I have individual level data (pidp) and I know where the person was born (country) and whether or not she holds a UK or non-UK degree (degree=1). I would like to define dummies for country of origin of the degree assuming that a non-UK degree is obtained from the country of birth. All UK natives (country=500) received their degree in the UK, hence all UK folks who got a degree from abroad are dropped. As the reference or omitted dummy variable category, I would like to have UK degree. Countries 7 and 8 are just some generic countries.
I have 120 countries in my sample plus the UK (500). Below are the data for four generic individuals 1,2,3, and 4. D7 is a dummy if degree obtained in country 7 and D8 if degree obtained in country 8.
So far, I have programmed this while I have generated indicator variables for each country:
local x 1
while `x'<=120 {
gen D`x'= 0
replace D`x' = 1 if country`x' ==1 & degree==1
local x=`x'+1
}
Now here comes my problem. How do generate the reference dummy category D500?
Note, it is turned on, when either UK person is present or a non-UK person with a UK degree (see D500 below).
It seems to me that I am doing something wrong because I have in the example below three location of degree dummies but I have four countries I am dealing with.
Not sure if I bring my point across, but I hope I have given all the info needed for people to know what I am trying to do.
Help is as usual much appreciated.
Thanks in advance.
Nico
I have individual level data (pidp) and I know where the person was born (country) and whether or not she holds a UK or non-UK degree (degree=1). I would like to define dummies for country of origin of the degree assuming that a non-UK degree is obtained from the country of birth. All UK natives (country=500) received their degree in the UK, hence all UK folks who got a degree from abroad are dropped. As the reference or omitted dummy variable category, I would like to have UK degree. Countries 7 and 8 are just some generic countries.
I have 120 countries in my sample plus the UK (500). Below are the data for four generic individuals 1,2,3, and 4. D7 is a dummy if degree obtained in country 7 and D8 if degree obtained in country 8.
So far, I have programmed this while I have generated indicator variables for each country:
local x 1
while `x'<=120 {
gen D`x'= 0
replace D`x' = 1 if country`x' ==1 & degree==1
local x=`x'+1
}
Now here comes my problem. How do generate the reference dummy category D500?
Note, it is turned on, when either UK person is present or a non-UK person with a UK degree (see D500 below).
It seems to me that I am doing something wrong because I have in the example below three location of degree dummies but I have four countries I am dealing with.
Not sure if I bring my point across, but I hope I have given all the info needed for people to know what I am trying to do.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str4 pidp str2(D7 D8) str4 D500 str7 country str6 degree "1" "1" "0" "0" "7" "1" "2" "0" "1" "0" "8" "1" "3" "0" "0" "1" "7" "0" "4" "0" "0" "1" "500" "0" "" "" "" "" "" "" end
Thanks in advance.
Nico
Comment