Hi, I have a large dataset (as in table A) with around 100 variables that represent different diagnosis/procedure codes. Each row represents one patient. Table A var1 var2 var3 … var100 diag1 diag2 diag4 diag3 diag5 diag4 ... diag800 diag4 diag16 I also have a separate table, with values for each of the diagnosis/procedure codes (altogether more than 10 000 different codes). The values range from 1-40, so many diagnosis codes have the same value. Table B diagnosis_code value diag1 12 diag2 4 diag3 21 diag4 39 I would like to merge this into my original value for each variable, to get something like this as a result: Table C var1 var2 var3 … var100 value_var1 value_var2 ... diag1 diag2 diag4 12 4 diag3 diag5 diag4 ... diag800 21 13 diag4 diag16 39 19 Of course I can merge in the Table B for each of the 100 variables, but this will take too long. Therefore I am thinking of constructing an array and checking for each of the values (its 40 possible values): array diagnosis{i} {100} var1 - var100{ if diagnosis{i} in list{all variables with value 1} then value_diagnosis{i} = 1 ... if diagnosis{i} in list{all variables with value 40} then value_diagnosis{i} = 40 But this involves a lot of manual work - I am currenlty copy pasting the list of variables with a particular value. Is there any more efficient way? How could I create the list from the Table B in a better way? I am using SAS Enterprise Guide, version 7.1 Many thanks indeed!
... View more