Dear Stata forum members,
I would like some help with the creation of certain variables.
The variables I already have are two categorical variables named 'vertical mismatch' and 'horiztonal mismatch'. Now I combined these two into the category of 'double mismatch' for observations having both a vertical and horizontal mismatch. The following code was used:
generate doublemismatch = 1 if vertical == 1 & horizontal == 1
replace doublemismatch = 0 if doublemismatch == .
label variable doublemismatch "doublemismatch"
label define doublemismatchl 1 "doublemismatch" 0 "other"
label values doublemismatch doublemismatchl
Now the issue that I have is that observations with a double mismatch are also still in the vertical and horiztonal categories. How do I prevent an observation that is considered a 'double mismatch' to be counted in the vertical or horizontal mismatch?
Thanks in advance,
Gavin
Related Posts with Creating variables
ReorderingHi everyone, I have a Birth history dataset with given mother id, child id, children birth order. I…
Discrete choice latent class model with blocking of choice setsI am trying to run a latent class model using the gsem command in Stata 16.1 I have 7 attributes of …
Dependent binary variable with relative frequiencies of 5% and 95%I have a binary dependent variable with the following frequency distribution: Yes (1128) and No (240…
Split string variables into different partsHi, I am using Stata 16 and would need some help in splitting a string variable and destring the va…
How to find the mean of subset of individualsI have data from several thousand observations on education level (discrete variable that ranges fro…
Subscribe to:
Post Comments (Atom)
0 Response to Creating variables
Post a Comment