I have a dataset which shows the population of Copenhagen in the late 1800s.
And I am interested in getting an overview of which kinds of familymembers the housholds concists of and of how many there are of each combination.
There are a lot of variables, (age, name, etc)
But the two variables which I am interested in are Household number and position in the household.
The household number is a number given to each observation that is in one household. So a family living together each have the same household number.
The position in the household variable has 69 different values. But I have created two sets of dummy variables for each value, one that shows if the observation has the given value (for example servant: 0 or 1) and one that shows if the entire household has one or more of the given value (servant_in_household 0 or 1)
that therefore shows a 0 for each dummy, except for the one dummy that shows the observations position in the household.
my dataset looks like this (not shown, all the 69 dummy variables with 0's and 1's, and other less important variables) :
Array
(postid: individual in the census. Husstnr: household number. civilstand: marital status. Stilling i hustand: position in household)
Now, heres my question:
Can I get Stata to show me a list of the number of households, grouped together by the combinations of positions in the households it has, and then listed from most households of this kind to least.
I'm assuming I first have to sort by household, but besides that, I am at a loss.
This is my dream, getting a list that looks like this:
5689 households containing: mom, dad, child, child
4054 households containing: mom, dad, child child, servant
3009 households containing: mom, dad, child, servant servant
2098 households containing: mom, dad, aunt, child, child, servant
1008 households containing: dad, child, aunt, servant
698 households containing: sister, sister, servant
etc. ..
So it can tell me which household combination of people is the most normal.
My stata is a IC/15.1.
I hope someone can help me.
Related Posts with Creating a list of most common households in a census dataset.
preparing data for propensity score matchDear All, I want to analyze if the gain in public health insurance due to this policy (Medicaid exp…
Loop mixed model over a least of predictors and store the coefficients and P valuesHi, I want to loop a mixed model over a list of predictors (fixed effects) and store the coefficien…
Count number of individuals that gave an answer in a questionnarieI would like to know the code to know the number of individuals (each individuak is identified by th…
Specifying a 'fill in the blank' variable in a loopHello, I'm sure this is a function but I'm having trouble finding it -- I'm trying to make a loop t…
Replace a observation by a missing valueI would like to know the command to replace the observations where it is written "refusal" and "don´…
Subscribe to:
Post Comments (Atom)
0 Response to Creating a list of most common households in a census dataset.
Post a Comment