I have a multiple cross-sectional dataset, where I am trying to create the following index:
Dit = (Sum all dit until k)/Kt
In other words, sum the values for all d variables and then divide by the number d variables for that year.
In my dataset, i have 4 variables that i need to look at but for some years only three or two are present so to calculate my index I don't want to just include individuals that had all four. I don't want them to be treated as missing. Instead, i want the aggregated variables to be divided by say 3 instead of 4 if only 3 variables are present. How do i go about creating this Kt?
My four variables are: racmar, racpeers, racpres and racseg. They are byte variables (not string) and are non binary.
Related Posts with How to count the number of relevant variables present for an individual
Proportional redistributionI have a dataset with a variable sex (male, female, unknown), I want to create a new variable that w…
compare value different variable and rowshello,
I want to compare values of two varible in diffrent rows.
For example
vr1 vr2
10 20
20 30
40 …
Reshape Data panel to wideHi everyone,
I struggle to reshape my panel data to wide.
The idea is to start from this:
Code:
…
how to remove certain value?Hello!
I'm a new STATA user and I have a variable like this:
Physical activity
3
4
3
2
0
How can …
How to do bootstrap test for a nonlinear mediation effect with a moderator and fixed effectsHi Statalist,
I have a problem about how to use bootstrap test to further detect a mediation proces…
Subscribe to:
Post Comments (Atom)
0 Response to How to count the number of relevant variables present for an individual
Post a Comment