Hi within a dataset I have been looking at there are 33 countries. I am trying to create a dummy variable for a UK native and a UK migrant. I'm wondering how I would create this variable. I have two variables that may help to do this. One is the Country name itself. Then there is a variable for country of birth.
I thought using both variables I could create a dummy variable for UK migrants and UK natives.
For UK natives I thought the command is:
gen UKnative = Country==UK | Country of birth==UK
So I want to create a UK native dummy variable which = 1 if the individual is a native in the UK
But I am struggling to do this for a UK migrant since there are many other countries. Would it be:
gen UKmigrant = Country==UK | Country of birth not = UK.
So I want to create a UK migrant dummy variable which =1 if the individual is a migrant in the UK
I am not sure how to do this
Related Posts with Generating new variable
Dates formatting questionHello, I have dates displayed in the standard numeric daily date (float) format like this: 11oct201…
Issues selecting correct functional form for multiple regressionHi all, I have been asked to verify the effect of water and sanitation on the mortality of children…
How to code my independent and dependent variable in an IV strategy with an intensity-of-treatment effectHello, I want to use an IV strategy to estimate the effect of an electrification policy on female l…
Call arguments from forvalues commandHello- I'm trying to write a simple program to display a status bar during a forvalues loop. Right …
Numbers at risk at time 0 in sts graph with risktable optionHello, I am working on a longitudinal dataset, with one or more observations/measures per patient. …
Subscribe to:
Post Comments (Atom)
0 Response to Generating new variable
Post a Comment