Hello,
I have 4 variables (coded 1=yes; 0=no) that tap into whether respondents used social media devices with parents, friends, relatives, and other adults.
I want to create a single variable that takes the following variables:
1 if discussed with parents
2 if discussed with friends
3 if discussed with relatives
4 if discussed with other adults
5 if discussed with parents and friends
6 if with parents and relatives
7 if with parents and other adults
8 if discussed with any combination all four
9 if discussed with all four
I used the following command,
gen most_use_sources = .
replace most_use_sources=1 if parents_dum==1
replace most_use_sources=2 if relatives_dum==1
replace most_use_sources=3 if friends_dum==1
replace most_use_sources=4 if otheradults_dum==1
replace most_use_sources=5 if parents_dum==1 & relatives_dum==1
replace most_use_sources=6 if parents_dum==1 & friends_dum==1
replace most_use_sources=7 if parents_dum==1 & otheradults_dum==1
replace most_use_sources=8 if num_source==3
replace most_use_sources=9 if num_source==4
However, the number of cases I am getting for the categories of the new variable are much much lower than the number of cases for each of the dummy variables separately. For example, the dummy for parents had about 900 cases, but there are only 44 cases for the parent category in the newly created most_use_sources =1 category.
I will appreciate some help to tease out these differences.
thanks - cY
Related Posts with Create a variable from other dummies
ANOVA REPEATE MEASURES - HOW TO INTERPRET CONTRADICTORY RESULTS BETWEEN ANOVA AND MULTIPLE PAIRWISE COMPARISONS (post hoc)?Good mornig to everybody. 1)HOW TO INTERPRET CONTRADICTORY RESULTS BETWEEN ANOVA AND MULTIPLE PAIRW…
Heteroskedasticity or other problem with regression?Hello everyone, so I run a pooled OLS regression on panel data of log real monthly wage on education…
Xtreg with Demeaned variablesI have a panel dateset and my dependent variable and independent variables are demeaned and standard…
Sum of values of a conditional variableI am new to using Stata, I have always made corrections using already clean bases. I have the variab…
Performing chi squared with one variable against a group of variables individuallyI've done a ton of looking around, and I've likely just not got the right key words, but my goal is …
Subscribe to:
Post Comments (Atom)
0 Response to Create a variable from other dummies
Post a Comment