Hi, there are 25 variables all with icd code in a sas files a, I need to create another 25 variables come with phecode based on ICD code and phecode library b. file a looks like: Id dx1 dx2....dx25; file b just have two variables: icd phecode I want a dataset like: id dx1 dx2 ....dx25 phecode1 phecode2 ....phecode25; I tried below code: %macro create_phecode_vars; %do i = 1 %to 25; proc sql; create table dxn as select a.*, b.phecoden as phecode&i from dxn a left join phecn b on a.dx&i eq b.icdn ; quit; %end; %mend; Log show WARNING: This CREATE TABLE statement recursively references the target table. A consequence of this is a possible data integrity problem. Any suggestions are appreciated.
... View more