Is there a way to create an array as a data structure in SAS? I'm trying to nest an if statement within various Do loops in order to get around having to code a very large number of if/else statements. I was thinking something like the attached code. However I've learned that SAS arrays are arrays of variables so this wouldn't work. data temp;
set TRNSSPLITCOLUMNS;
array hla{11} HLA-A HLA-B HLA-C HLA-DPA1 HLA-DPB1 HLA-DQA1 HLA-DQB1 HLA-DRB1 HLA-DRB3 HLA-DRB4 HLA-DRB5;
array allele{11} A B C DPA1 DPB1 DQA1 DQB1 DRB1 DRB3 DRB4 DRB5;
array dors{2} DNA SER;
array locus{11} 1-11;
array antigen{2} 1 2;
DO i=1 to 2; /*For antigen 1 and 2*/
DO j=1 to 2; /*For DNA and SER*/
DO k=1 to 11; /*For each of the antigen loci variable*/
DO l=1 to 11; /*For each HLA locus*/
If cat('Antigen',antigen{i},'_locus',locus{k}) = hla{l} and cat('Antigen',antigen{i},'_typ_meth',locus{k}) = dors{j}
then cat(allele{l}, '_',dors{j},'TYP',antigen{i}) = cat('Antigen',antigen{i},'_GenTyping',locus{k});
end;
end;
end;
end;
run;
... View more