***generating a random numbers to create a data set ; data a(keep=vars); do j=1 to 18; vars=int(abs(rannor(j)*100)); output; end; run; %macro one(yn=2,qr=3);***year come from 1999 to 2000;***set quarter 3; %do i=1 %to 3;***read in three variables; data b&i; year=1998; onum=(&i-1)*6; do m=1 to &yn;***control the year; year=year+m; do n=1 to &qr;***control the quarter; on=onum+n;***control the point number; quarter=n; set a point=on;***control the observations numbers; var&i=vars; output; end; onum=on; end; stop; run; proc sort; by year quarter; run; %end; %mend; %one data c(drop= m onum n vars); merge b1 b2 b3; by year quarter; run; proc print data=a; title 'The Raw Data Set'; run; proc print data=c; title 'The Objective Data Set'; run;