Hello, I am using household data and need to create a dummy variable between pairs of variables to indicate if they are same-sex or not. My variables include Gender (2=male, 4=female), HouseholdID (string of numbers), and StatusinHH (I am concerned with only values 1=Head of Household and 2=Spouse, although there are other options (3=child, etc)).
input str11 householdid float(gender hhstatus)
"000015002" 2 1
"000015002" 4 2
"000015003" 2 1
"000015003" 4 2
"000015004" 2 1
"000015004" 4 2
"000015004" 2 5
"000015004" 4 4
"000015005" 2 1
"000015005" 4 2
"000015006" 4 1
"000015007" 4 1
"000015007" 4 5
"000015007" 4 5
"000015008" 4 1
"000015008" 4 4
"000015009" 2 1
"000015009" 4 2
"000015010" 2 1
"000015010" 4 2
"000015010" 4 3
"000015011" 2 1
"000015011" 4 2
"000015012" 2 1
"000015012" 4 2
"000015012" 4 3
I need to create a dummy variable for each person within the household to indicate whether they are in a same sex relationship or not. This will be based on having same gender between the 2 individuals with a StausinHH of 1 or 2 within the same household.
Can anybody help me with how to go about this? Thanks so much!
Related Posts with Creating Dummy Variable based on Duplicate Values between Variables
How to use explicit coding for multiple dummies in regression (no factor notation)Hi. I would like to run a fixed effects regression containing a continuous-categorical interaction w…
Generalized Difference-in-differences with two-way fixed effect modelDear researchers, I have used the following model: Code: xtreg GG i.Event##(c.centered_Age c.cente…
Unbalanced Panel data xtlogit Hi all, I have unbalanced panel data from 2010-2017 of people who participated in a screening prog…
String variablesHi STATALIST, I have a string variable and detected ga68 out of it by: Code: gen ga68 = (strpos(…
Determining annual percent change in binary variableHi there, I was working with a large dataset and I am working with trends over time. I was trying t…
Subscribe to:
Post Comments (Atom)
0 Response to Creating Dummy Variable based on Duplicate Values between Variables
Post a Comment