Hello,
I am really bad in stata and need help. I have a database with 3 variables: birthcountry, authoritarian_mothercountry, authoritarian_fathercountry.
I want i generate a new variable that gives a 0 or a 1 if it matches with specific values from those 3 variables.
so:
gen authoritarian_parents== 1 if authoritarian_mothercountry or authoritarian_fathercountry ==1 & authoritarian_birthcountry == 0
So if the variable birthcountry == 0 and authorian_mothercountry or authoritan_fathercountry==1 then I want my new variable to take the value 1 for all observations, if not then I want it to have the value 0.
Thank you for any suggestions.
Related Posts with Creating a new variable, from specific values of 3 existing variables
Export to excelHello!! I am trying to export summary statistics like n mean sd median iqr min max for a series of …
suest with "too many base levels specified"?Dear All, I was asked this question from a friend. The error message is Array Any suggestion on thi…
Measuring the % of variance by explanatory factors in regression modelsIs there any way in Stata 14 to measure the percentage of variance for a given IV. I came across an…
Testing coefficient equality in (subsample) panel data regressions?Dear All, Suppose that I have the following code, Code: webuse grunfeld, clear gen ind = company …
Stata states varlist not allowed with Coefplot CommandI am a new user to Stata. I am working on a dataset from an experiment that looked at how male and f…
Subscribe to:
Post Comments (Atom)
0 Response to Creating a new variable, from specific values of 3 existing variables
Post a Comment