Find the effect of a attribute value on an outcome by eliminating confounding values I have a series of lets say five attributes. The first attribute is called diagnosis code 1, the second diagnosis code 2 etc. The values are codes which represent diseases. In other words, each observation, can have up to five DIFFERENT diagnoses.
I want to know the impact of one given diagnosis code on a specific outcome (Length of Stay for example), but in order to do this, I have to eliminate the confounding effect of the coexisting diseases to the length of stay. I am sort of stuck on how I can do this.
Almost all patients (observations) have data in all their five diagnosis slots. This is going to be part of a software, but I would first like to understand the overall approach of how to solve this, and then we will think about the programming part.
thanks!
 A: You might be better off foregoing the kind of control you're looking to do and instead recoding the five diagnostic variables into one variable that has as many levels (categories) as there are diseases covered by your five variables.  In that way you'll have a clear indication of whether the person has disease 1, 2, 3, etc.  
If you're working with fine-grained diagnostic codes and therefore have hundreds or thousands of levels, you will likely have a degree-of-freedom problem (far too many parameters to estimate given your sample size).  In that case you'll want to re-categorize, e.g., as one does when using Diagnostic-Related Category (DRG) or some other simplified scheme as an alternative to International Classification of Diseases (ICD) code.
Control for confounders may yet be possible, but only if you are working with a really manageable number of categories.  To estimate the effect of disease 1 on length of stay while controlling for diseases 2 through 250 will, I expect, give you muddied results that will not be interpretable; will not be effective for prediction;  and will not furnish reliable indicators of causality. 
