I am trying to select cases which have specific diagnosis codes. Diagnosis codes are stored in multiple columns DX1, DX2, DX3, DX4 .....etc' for each patient. Each patient could have multiple diagnosis. If the ICD code 75673 matches in any of the diagnosis column that means that that case (patient) had specific diagnsis-in this case gastroschisis and GastroID should be recorded as 1, other wise GastroID should be 0.
Sometimes ICD codes are in range and each diagnosis column needs to be checked against one of the ICD code in the range. For example Abdominal wall defects consist of codes between 7567 to 75679.
I tried to loop as under. it creates the column name GastroID but the output is not "1" or "0". What I may be doing wrong?
DEFINE FINDCASES (ICD=!CHAREND("/") /
DX=!CMDEND).
!DO !I !IN (!ICD)
!DO !J !IN (!DX)
!IF (!J = !I) !THEN COMPUTE GastroID=1
!ELSE COMPUTE GastroID=0
!IFEND
!DOEND
!DOEND
!ENDDEFINE.
FINDCASES ICD = '75673' /DX=DX1 DX2 DX3 DX4.