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
Sum rows conditionalHi all, I have been trying to sum rows given some conditions but I am unable to. I would like to su…
Marginsplot: logit regression, IV is continous and moderator is a dummyDear Statalist, I run a logit regression and my IV is a continuous variable (average: -1.5, min: -2…
dummy in OLS regression biased by other categorical variable in the sampleHi, (this is a re-post of a previous post I have posted by accident with a title that I was not yet…
Checking Parallel Trends assumptionGood Afternon everyone, I am writing this post in order to receive some help with the verification o…
generalized/staggered difference-in-difference with moderatorHello I am using a generalized/staggered difference-in-difference approach to investigate the effec…
Subscribe to:
Post Comments (Atom)
0 Response to Generating new variable
Post a Comment