I tried so speed up the run time with proc ds2 instead of normal proc sql, but it looks like something is wrong with my codes. The normal proc sql gave me real time of 13:30, while proc ds2 gave me 16:04. To my understanding, proc ds2 should be faster cause it uses multiple thread, but that is not what I've seen. I copied the code below. If someone can help me out, that will be great I also try PROC FEDSQL, but the run time is similar to a normal proc sql. Thanks. %macro loopthrough(from_date, to_date); LIBNAME test1 db2 DSN='xxx' USER='xxx' PASSWORD='xxx'; %local filedate; %do filedate=&from_date %to &to_date; %if %substr(&filedate,5,2) ge 01 AND %substr(&filedate,5,2) le 12 %then %do; /* %if %substr(&filedate,5,2) = 12 %then %do;*/ data _null_; tmp = intnx('month',input("&filedate",yymmn6.),0,'e'); call symput('adate',put(tmp, yymmdd10.)); run; Proc DS2; Data QRM_DEP_REF_&filedate (overwrite=yes); method run(); set { SELECT * FROM connection to test1 (SELECT DW.RLTN_DIM.A AS ACCT_NBR, ORG_HIST_INT.B AS AffiliateNumber, ... FROM ... WHERE ... )}; end; enddata; run; QUIT; %end; %end; %mend; %loopthrough(from_date=201303, to_date=201303);
... View more