Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: check 2 of 3 variables agree a majority decision captured in 4th variable


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: check 2 of 3 variables agree a majority decision captured in 4th variable
Date   Thu, 5 Oct 2006 11:48:06 -0400

Eamonn--
input   var1   var2   var3   var4
      2      2      5      2
      2      3      5      5
gen vmax=max(var1,var2,var3)
gen check4=var1 if var1==var2
replace check4=var1 if var1==var3
replace check4=var2 if var3==var2
replace check4=vmax if mi(check4)
drop vmax
tab var4 check4

On 10/5/06, Eamonn O'Brien <Eamonn.O'[email protected]> wrote:
I wonder if someone can get me started on how to approach a problem I
wish to solve. I have searched the archives and not seen anything that's
too similar.

I have variables var1, var2, var3 & var4. Variables var1 var2 & var3
are three independent results of a screening test. The independent
result (ordered categorical) is either normal, borderline, mild, mod or
severe. Variable Var4 is the final result and it is meant to be based on
the majority decision. So if var1 & var3 are borderline for example,
var4 should be borderline, regardless of var2. Another example, if var2
& var3 are severe, var4 should be severe regardless of var1. Where all
three differ I would like to check that var4 is the worst of var1, var2,
var3. If I can get started I think I can develop it to check for missing
values, but I am not sure if I should approach this problem with if
statements or -assert- or something else?



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index