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
Multiple loops of varlists and outreg2 for quantile regressionsDear Statalists, I hope anyone can help me with my regressions with loops because I am quite new to…
Calculation of Kolm–Pollack Index.Hello everybody! I.m trying to calculate the Kolm–Pollack Index of inequality for the distribution …
Value Labels and Appending DataI have a question about the appending data from multiple rounds of surveys across 10 countries from …
Parallel Coordinates and playing around with graphIn using the parcoord command, I am finding it difficult to move from the default colors provided by…
Pairwise Comparisons of Average Marginal EffectsHi, I am aiming to look at the different effect on earnings of increasing the number of dependent ch…
Subscribe to:
Post Comments (Atom)
0 Response to Creating Dummy Variable based on Duplicate Values between Variables
Post a Comment