I have clams data with diagnosis column DX1 to DX15 which stores ICD9 codes. I want to create a categorical combined variable (Premature here) where DxLabel is category and icd9 is the corresponding code. Such pairs could be different each time, may be 4 once, may be 40 next time. Hence I want to be able to only modify two arrays and get the categories situated in one column-(here Premature) Following code does not work and can someone help me fix it? %let ColName = Premature; data RSLTTBL; /* This is the name of result table */ set PLYGRND.kid_2006; /* Copy table from this table */ array diagcol(*) DX1-DX15; /* Define arrary of Diagnosis columns */ array icd9(4) _TEMPORARY_ (76520 76521 76522 76523); array Dxlabel(4) Unspecified LessthanGA24 GA24 GA2526; length &ColName $10; /* Define new variable */ &ColName="None"; /*Assign Value to new variable*/ do i=1 to dim(icd9); if whichn(icd9[i],of diagcol(*))>0 then &ColName=Dxlabel[i]; /*Assign Value to new variable ---I think the problem is here.*/ end; drop i; run; proc freq data=rslttbl; tables Premature; run;
... View more