arrays

#1
hi everyone
can you please explain what the following code does? in particular the varnum macro?
context: medical coding.

data step2(compress=yes);
merge diagind(in=inind)
who(in=inreg);
by recipno;
if inreg;
array dind{*} 3 %names;
retain %names;
length i 3;
drop i;
do i=1 to dim(dind);
if dind{i}=. then dind{i}=0;
end;

*new combined transplant code;
if HLTRNS=1 then do; CARVH=1; PULVH=1; end;

* Create hierarchy ;
array vars1{*} AIDSH INFH HIVM INFM INFL;
array vars2{*} CANVH CANH CANM CANL;
array vars3{*} CARVH CARM CARL CAREL;
array vars4{*} CERL;
array vars5{*} CNSH CNSM CNSL;
array vars6{*} DIA1H DIA1M DIA2M DIA2L ;
array vars7{*} DDM DDL;
array vars8{*} EYEL EYEVL;
array vars9{*} GENEL;
array vars10{*} GIH GIM GIL;
array vars11{*} HEMEH HEMVH HEMM HEML;
array vars12{*} METH METM METVL;
array vars13{*} PRGCMP PRGINC;
array vars14{*} PSYH PSYM PSYML PSYL;
array vars15{*} SUBL SUBVL;
array vars16{*} PULVH PULH PULM PULL;
array vars17{*} RENEH RENVH RENM RENL;
array vars18{*} SKCM SKCL SKCVL;
array vars19{*} SKNH SKNL SKNVL;

%macro varnum(num);
do i=1 to dim(vars&num)-1;
if vars&num(i)=1 then do j=i+1 to dim(vars&num);
vars&num(j)=0; end;
end; drop j;
%mend varnum;