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
stata16.1 updateI updated my stata, but a new problem occurred. After I entered the "help" command in the command wi…
To calculate values with sevral IF commandsHi, can anyone help me to write a code for some calculations? To calculate the final grade for each …
Median incomeHi folks, The data below is a sample survey data. How do i generate the median annual income per ye…
Specify default for string argument to Stata -program-I'm writing a Stata program, but having trouble specifying a default value for the string argument m…
mediation analysis with multiple mediatorsDear Stata users, I am new to mediation analysis, so I am still learning but from what I read it se…
Subscribe to:
Post Comments (Atom)
0 Response to Creating variables
Post a Comment