Dear members,
I am struggling with a complicated coding.
I have female_friends and male_friends. Each of the variable has 0 friends (0), 1-2 friends (1) 3-4 or more (2)- 3 categories. Then I have a variable "gender" (males = 0, females=1)
For a new variable, I would like to create 1= no friends or same-sex friends and 2= mixed sex friends (a female having both female and male friends, a male having both male and female friends).
The new variable can be called "peers_sex_composition"
If a female (or male) does not have any friends (female_friends = 0 & male_friends = 0) then the new variable should be coded as 1.
If a female has only female_friends = 1/2 BUT male_friends =0, then this also should be coded as 1.
If a female has mixed sex friends (both female and male friends) in other words, female_friends= 1/2 & male_friends =1/2 then new variable will be 2.
For the male, it would be the same (3 options) but both female and male should be combined into one single new variable "peers_sex_composition."
Please, could you help me with syntax?
Thanks
best, Rinko
Related Posts with Complicated coding - female/male friends - same sex or mixed-sex
Cannot use python in Stata 16.1 in CatalinaCannot use python in Stata 16.1 in Catalina Today, 03:38 I have tried to solve the problem, but it …
Display full name of variableHi, When I use the list variable, display short name "chan~n_3", but it is actually "change_land_own…
Cannot use python in Stata 16.1 in CatalinaI have tried to solve the problem, but it seems to be stubborn. What to do? I installed the new vers…
Display full name of variableHi, I want to see variable name "change_land_own_3" , instead of "chan~n_3" . How should I do it? …
Questions about "xtrifreg" - Unconditional quantile regression with fixed effects?Dear Statalists, (1) Can anyone help me check robustness for "xtrifreg" please? And how can I run s…
Subscribe to:
Post Comments (Atom)
0 Response to Complicated coding - female/male friends - same sex or mixed-sex
Post a Comment