%* try this out - its not clear where you get saleNbr from; %macro fq (ps=,saleNbr=); Proc sort data = fin_sale_&ps out = sale_&ps; by part_number; run; data total_sale; /*merge sale_1(in=a) sale_2(in=2) sale_3(in=3) sale_4(in=4) sale_5(in=5) sale_6(in=6);*/ merge %do i = 1 to &saleNbr.; sale_&i.(in=a&i.); %end; ; %* this semicolon ends the merge statement; by part_number; run; %mend; %* note differing saleNbr value; %fq (ps=1,saleNbr=6); %fq (ps=2,saleNbr=6); %fq (ps=3,saleNbr=15); %fq (ps=4,saleNbr=6); %fq (ps=5,saleNbr=6); %fq (ps=6,saleNbr=16);
... View more