Hi, I want to create a dummy variable for whether an individual is a 1st or 2nd generation migrant. I am using 3 variables to do this:
Born in the country - which takes value 1 if yes and 2 if not
Mother born in the country - which takes 1 if yes and 2 if not
Father born in the country - which takes 1if yes and 2 if not
A first-generation migrant is defined as them or their parents being born elsewhere- the code I did for this was:
born in country * mother born in country* father born in country >=2 Which came out correct
However, I am struggling as a second-generation migrant. Here second-generation migrant is a native-born population with at least one parent being born elsewhere.
I tried the code:
Born in country==1 | Mother born in country * father born in country >=2
However this is not working
Any help to do this more effectively or correctly. Thank you
Related Posts with Generation dummy variable
how to create a categorical dummy from a group of dummy variablesHi everyone, I want to create a categorical dummy called Engagement, which should take its values f…
Invalid syntax; not obvious what is wrong.Dear All, I have a 7 year state panel of US states: Code: Code: * Example generated by -dataex-. …
Help converting time series data to panel dataDear Members, I hope you could help me with the following problem, I have an dataset which contains…
Specification of Known Latent Classes using gsem lclassDear StataList, I am using Stata 14 on a Mac OS Yosemite 10.10.5. I am trying to use gsem to weight…
How do I find for a certain value (numeric/string) in one variable if there exists a value (numeric/string) in another variable??My dataset look similar to this Id MathBaseline. WPMBaseline. NepaliBaseline MathPost WPMPost Nepal…
Subscribe to:
Post Comments (Atom)
0 Response to Generation dummy variable
Post a Comment