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
3 dimensional panel clusteringHi, I have a 3 dimensional panel: country, firm, date. I use xtset countryfirm date. and I want to c…
output the results of xtunitrootDear All, How can I output (word or excel) the testing results of -xtunitroot- command. For example,…
Heckman selection modelHi, In my first stage selection model, a person can be selected by multiple companies, which leads t…
Unique IDs constant over multiple observations and variablesHello everyone, New to STATA and love the helpful community I've been seeing, any help will be much …
Stata implementation of Conway's Game of LifeConway's Game of Life is a cellular automaton devised by John Conway in 1970, in which cells on an i…
Subscribe to:
Post Comments (Atom)
0 Response to Creating Dummy Variable based on Duplicate Values between Variables
Post a Comment