As mentioned in a prior question (kindly answered with perfectly working syntax) I have a very large dataset of multiple diagnoses (25) per patient represented by ICD 10 codes in SPSS. For brevity sake I have posted a snapshot of what I am attempting to replicate simply using a test dataset of 3 string variables labeled DIAG1 to DIAG3 and random codes:
Assume each row represents a patient. The outcome presented in column "O74Updated" is what I am attempting to replicate. Essentially a presence/absence variable with a number representing the number of times a patient had an "O74" diagnoses across any one of the "DIAG" columns. The current working syntax that generates the outcome in column "O74" is:
compute O74 = 0.
do repeat x = DIAG1 to DIAG3.
if O74=0 O74 = (char.index(UPPER(x),'O74')>0).
end repeat.
As mentioned, the syntax provided by above runs wonderfully. However, I have come across a few hundred patients whom have multiple diagnoses of a "O74" which the above code does not accurately capture. I want to ensure all incidence of O74 are accounted for by providing a total count for each patient. Is it possible to ensure patients with multiple diagnoses are accounted for in the syntax provided above?
Again, I greatly appreciate any input/guidance into what is likely a very elementary syntax question in SPSS.