1

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:

enter image description here

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.

eli-k
  • 10,898
  • 11
  • 40
  • 44
Walkeram
  • 25
  • 4

1 Answers1

2

The syntax in your post yields a 1 in case any of the diagnoses contains 'O74' in it. A small change in the syntax will make it count the number of occurrences:

compute O74 = 0.
do repeat x = DIAG1 to DIAG3.
if char.index(UPPER(x),'O74')>0 O74 = O74 + 1.
end repeat.
eli-k
  • 10,898
  • 11
  • 40
  • 44