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
The percentage of market overlapping between two firms over the past 5 yearsDear all, I am trying to figure out how to calculate the proportion of market overlap between firm…
-margins,predict(pr)- after -ivprobit- yields opposite sign from coefficientsDear colleagues, I am interested in the marginal effect of the continuous endogenous regressor X1 o…
generating a new variable using bysort in panel datasetHi there, I am currently using StataMP 15.1. I am trying to generate a new variable for the freque…
extracting observations with several conditionsHi I am a stata beginner. I want to extract observations satisfying several conditions but it is re…
Relative changes between different levels and in different periodsHi I want to measure how many patients which, in period T, were in one of the levels of disease mov…
Subscribe to:
Post Comments (Atom)
0 Response to Generating new variable
Post a Comment