一个大苹果 发表于 2012-3-30 16:36
向您请教,我在也感觉宏程序要比单独手工运行慢,这是必然的吗?
I read your programs. There are many places you can improve upon. It seems you have many unnecessary steps. The strategy many be wrong.
The SAS macro generates SAS codes fast enough. I never see any one complaints about SAS macro being slow.
It seems you have total 10*92*24 regressions. I try to reproduce what you do according to your programs. I don't know what is the size of your problem. I run obs=30 and 300 with total obs=22080*(30 and 300) and two variables.
You can see the log below. Total of 10*92*24=22080 regression finishes with 4 seconds with 30 obs in each regression and less than 13 seconds for a 10 times problem.
44 data t1;
45
46 do group=1 to 10*92*24;
47 do j=1 to 30;
48 x1=rannor(123);x2=rannor(123);
49 y=1+1*x1+1*x2+rannor(123);
50 output;
51 end;
52 end;
53 run;
NOTE: The data set WORK.T1 has 662400 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 1.03 seconds
cpu time 0.40 seconds
54
55 proc reg data=t1 outest=parms noprint;
56 by group;
57 model y=x1 x2;
58 output out=out p=py;
59 quit;
NOTE: The data set WORK.PARMS has 22080 observations and 9 variables.
NOTE: The data set WORK.OUT has 662400 observations and 6 variables.
NOTE: PROCEDURE REG used (Total process time):
real time 3.62 seconds
cpu time 3.12 seconds
64 data t1;
65
66 do group=1 to 10*92*24;
67 do j=1 to 300;
68 x1=rannor(123);x2=rannor(123);
69 y=1+1*x1+1*x2+rannor(123);
70 output;
71 end;
72 end;
73 run;
NOTE: The data set WORK.T1 has 6624000 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 3.95 seconds
cpu time 2.46 seconds
74
75 proc reg data=t1 outest=parms noprint;
76 by group;
77 model y=x1 x2;
78 output out=out p=py;
79 quit;
NOTE: The data set WORK.PARMS has 22080 observations and 9 variables.
NOTE: The data set WORK.OUT has 6624000 observations and 6 variables.
NOTE: PROCEDURE REG used (Total process time):
real time 15.17 seconds
cpu time 12.19 seconds