Hi A quick question. I have several datasets (HR1, HR2, HR3,.....HR 20) I need to combine a number of these tables using (data..set) according to certain criteria, since this is a repetitive task I chose to build a macro like this %macro repeat_set(n=); %do var=1 %to &n; Data j; if &var=1 then do; set HR&var; end; else if &var gt 1 then do; set j HR&var; end; run; %end; %mend; The reason why I am doing this is that the new dataset 'J' dose not exist from the beginning, so while looping, the idea is when the code takes the first HR set (HR1) it will create 'j' using the following: data j; set HR1; run; and for the consequent sets, like HR2 , it will do data j; set j HR2; run; and so on So when I do a %repeat_set(n=1); the code executes correctly BUT, when I do anything larger than 1, ex %repeat_set(n=5); The code combines only tables HR2-HR5. It seems as if HR1 contribution to the new set 'j' is "deleted" during the process. Any suggestions? Best regards
... View more