From: Bakary on 8 Jun 2010 03:06 On Jun 8, 3:49 am, Kaz <kazutoshi.shideh...(a)gmail.com> wrote: > On 6$B7n(B8$BF|(B, $B8aA0(B9:27, Reeza <fkhurs...(a)hotmail.com> wrote: > > > > > > > On Jun 7, 6:03 pm, Kaz <kazutoshi.shideh...(a)gmail.com> wrote: > > > > Dear SAS experts, > > > > I am currently trying to calculate coefficient, intercept adn R-square > > > for S&P500 and 10,000 shares. > > > > e.g. > > > proc reg data=share; model apple=sp500; run; > > > proc reg data=share; model ge=sp500; run; > > > proc reg data=share; model microsoft=sp500; run; > > > .... continues 10,000 times..... > > > > All data are avilable but I am wondering if you have to use "prog reg" > > > 10,000 times. > > > If you know better way by using base sas functions to calculate simple > > > linear regression > > > between S&P500 and 10,000 shares, could you please adivse me? > > > > Thank you for your support in advance. > > > > Kazutoshi > > > I'm wondering why you'd want to do that. If its an issue of license > > I'd suggest using R instead. > > > You could do it with IML or even Base but it wouldn't be recommended. > > Use the Right tool for the right job...- $B0zMQ%F%-%9%H$rI=<($7$J$$(B - > > > - $B0zMQ%F%-%9%H$rI=<((B - > In this macro, you can insert an "ods output" to create all regressions output that can be interested to analyse after. %macro a; %do i=1 %to 100; ods output ANOVA = anovax; ods output FitStatistics = fitx; ods output ParameterEstimates = parmx; proc reg data=share; model share&i=sp500; run; ods output close; ods output close; ods output close; %end; %mend a; %a; > Macro is not a problem but the time consumption for prog reg 10,000 > times. > The following macro takes about 2 sconds for each proc reg. > If you have faster method to do this, I would want to know. > > %macro a; > %do i=1 %to 100; > proc reg data=share; > model share&i=sp500; > run; > %end; > %mend a; > %a;
From: Kaz on 8 Jun 2010 05:51 On 6$B7n(B8$BF|(B, $B8a8e(B3:06, Bakary <b.dj...(a)ulg.ac.be> wrote: > On Jun 8, 3:49 am, Kaz <kazutoshi.shideh...(a)gmail.com> wrote: > > > > > On 6$B7n(B8$BF|(B, $B8aA0(B9:27, Reeza <fkhurs...(a)hotmail.com> wrote: > > > > On Jun 7, 6:03 pm, Kaz <kazutoshi.shideh...(a)gmail.com> wrote: > > > > > Dear SAS experts, > > > > > I am currently trying to calculate coefficient, intercept adn R-square > > > > for S&P500 and 10,000 shares. > > > > > e.g. > > > > proc reg data=share; model apple=sp500; run; > > > > proc reg data=share; model ge=sp500; run; > > > > proc reg data=share; model microsoft=sp500; run; > > > > .... continues 10,000 times..... > > > > > All data are avilable but I am wondering if you have to use "prog reg" > > > > 10,000 times. > > > > If you know better way by using base sas functions to calculate simple > > > > linear regression > > > > between S&P500 and 10,000 shares, could you please adivse me? > > > > > Thank you for your support in advance. > > > > > Kazutoshi > > > > I'm wondering why you'd want to do that. If its an issue of license > > > I'd suggest using R instead. > > > > You could do it with IML or even Base but it wouldn't be recommended. > > > Use the Right tool for the right job...- $B0zMQ%F%-%9%H$rI=<($7$J$$(B - > > > > - $B0zMQ%F%-%9%H$rI=<((B - > > In this macro, you can insert an "ods output" to create all > regressions output that can be interested to analyse after. > > %macro a; > %do i=1 %to 100; > ods output ANOVA = anovax; > ods output FitStatistics = fitx; > ods output ParameterEstimates = parmx; > proc reg data=share; > model share&i=sp500; > run; > ods output close; > ods output close; > ods output close; > %end; > %mend a; > %a; > > > > > Macro is not a problem but the time consumption for prog reg 10,000 > > times. > > The following macro takes about 2 sconds for each proc reg. > > If you have faster method to do this, I would want to know. > > > %macro a; > > %do i=1 %to 100; > > proc reg data=share; > > model share&i=sp500; > > run; > > %end; > > %mend a; > > %a;- $B0zMQ%F%-%9%H$rI=<($7$J$$(B - > > - $B0zMQ%F%-%9%H$rI=<((B -- $B0zMQ%F%-%9%H$rI=<($7$J$$(B - > > - $B0zMQ%F%-%9%H$rI=<((B - Thank you. I do realize ods is good tool but for 10,000 iteration, I am looking for better solution. I am thinking about Proc corr and proc means combination now. Kaz
From: Tom Abernathy on 8 Jun 2010 08:18 On Jun 8, 5:51 am, Kaz <kazutoshi.shideh...(a)gmail.com> wrote: > Thank you. > I do realize ods is good tool but for 10,000 iteration, I am looking > for better solution. > I am thinking about Proc corr and proc means combination now. > > Kaz- Hide quoted text - > > - Show quoted text - I am not sure I understand the question as this seems trivial. Why don't you just transpose your dataset and use a BY statement?
From: data _null_; on 8 Jun 2010 08:18 On Jun 8, 4:51 am, Kaz <kazutoshi.shideh...(a)gmail.com> wrote: > On 6$B7n(B8$BF|(B, $B8a8e(B3:06, Bakary <b.dj...(a)ulg.ac.be> wrote: > > > > > > > On Jun 8, 3:49 am, Kaz <kazutoshi.shideh...(a)gmail.com> wrote: > > > > On 6$B7n(B8$BF|(B, $B8aA0(B9:27, Reeza <fkhurs...(a)hotmail.com> wrote: > > > > > On Jun 7, 6:03 pm, Kaz <kazutoshi.shideh...(a)gmail.com> wrote: > > > > > > Dear SAS experts, > > > > > > I am currently trying to calculate coefficient, intercept adn R-square > > > > > for S&P500 and 10,000 shares. > > > > > > e.g. > > > > > proc reg data=share; model apple=sp500; run; > > > > > proc reg data=share; model ge=sp500; run; > > > > > proc reg data=share; model microsoft=sp500; run; > > > > > .... continues 10,000 times..... > > > > > > All data are avilable but I am wondering if you have to use "prog reg" > > > > > 10,000 times. > > > > > If you know better way by using base sas functions to calculate simple > > > > > linear regression > > > > > between S&P500 and 10,000 shares, could you please adivse me? > > > > > > Thank you for your support in advance. > > > > > > Kazutoshi > > > > > I'm wondering why you'd want to do that. If its an issue of license > > > > I'd suggest using R instead. > > > > > You could do it with IML or even Base but it wouldn't be recommended. > > > > Use the Right tool for the right job...- $B0zMQ%F%-%9%H$rI=<($7$J$$(B - > > > > > - $B0zMQ%F%-%9%H$rI=<((B - > > > In this macro, you can insert an "ods output" to create all > > regressions output that can be interested to analyse after. > > > %macro a; > > %do i=1 %to 100; > > ods output ANOVA = anovax; > > ods output FitStatistics = fitx; > > ods output ParameterEstimates = parmx; > > proc reg data=share; > > model share&i=sp500; > > run; > > ods output close; > > ods output close; > > ods output close; > > %end; > > %mend a; > > %a; > > > > Macro is not a problem but the time consumption for prog reg 10,000 > > > times. > > > The following macro takes about 2 sconds for each proc reg. > > > If you have faster method to do this, I would want to know. > > > > %macro a; > > > %do i=1 %to 100; > > > proc reg data=share; > > > model share&i=sp500; > > > run; > > > %end; > > > %mend a; > > > %a;- $B0zMQ%F%-%9%H$rI=<($7$J$$(B - > > > - $B0zMQ%F%-%9%H$rI=<((B -- $B0zMQ%F%-%9%H$rI=<($7$J$$(B - > > > - $B0zMQ%F%-%9%H$rI=<((B - > > Thank you. > I do realize ods is good tool but for 10,000 iteration, I am looking > for better solution. > I am thinking about Proc corr and proc means combination now. > > Kaz- Hide quoted text - > > - Show quoted text - There a better ways and non of them involve macro looping. < label: > MODEL dependents=<regressors> < / options > ; Notice that dependents is plural. Have you tried using the 10,000 variables on the left hand side of the equation. proc reg; model apple--ge = sp500; output ....; run; It might not work with 10,000 variables. RTFM for "sas variable list" and MODEL statement in PROC REG. OR rearrange the data so you call PROC REG one time BY SHARE. The new data will have variables. Share (ge, microsoft, apple); Y (the values currectnly stored in ge microsoft etc.) SP500 (same) proc reg; by share; model y = sp500; output ..... run;
From: Kaz on 8 Jun 2010 21:13 On 6$B7n(B8$BF|(B, $B8a8e(B8:18, "data _null_;" <datan...(a)gmail.com> wrote: > On Jun 8, 4:51 am, Kaz <kazutoshi.shideh...(a)gmail.com> wrote: > > > > > > > On 6$B7n(B8$BF|(B, $B8a8e(B3:06, Bakary <b.dj...(a)ulg.ac.be> wrote: > > > > On Jun 8, 3:49 am, Kaz <kazutoshi.shideh...(a)gmail.com> wrote: > > > > > On 6$B7n(B8$BF|(B, $B8aA0(B9:27, Reeza <fkhurs...(a)hotmail.com> wrote: > > > > > > On Jun 7, 6:03 pm, Kaz <kazutoshi.shideh...(a)gmail.com> wrote: > > > > > > > Dear SAS experts, > > > > > > > I am currently trying to calculate coefficient, intercept adn R-square > > > > > > for S&P500 and 10,000 shares. > > > > > > > e.g. > > > > > > proc reg data=share; model apple=sp500; run; > > > > > > proc reg data=share; model ge=sp500; run; > > > > > > proc reg data=share; model microsoft=sp500; run; > > > > > > .... continues 10,000 times..... > > > > > > > All data are avilable but I am wondering if you have to use "prog reg" > > > > > > 10,000 times. > > > > > > If you know better way by using base sas functions to calculate simple > > > > > > linear regression > > > > > > between S&P500 and 10,000 shares, could you please adivse me? > > > > > > > Thank you for your support in advance. > > > > > > > Kazutoshi > > > > > > I'm wondering why you'd want to do that. If its an issue of license > > > > > I'd suggest using R instead. > > > > > > You could do it with IML or even Base but it wouldn't be recommended. > > > > > Use the Right tool for the right job...- $B0zMQ%F%-%9%H$rI=<($7$J$$(B - > > > > > > - $B0zMQ%F%-%9%H$rI=<((B - > > > > In this macro, you can insert an "ods output" to create all > > > regressions output that can be interested to analyse after. > > > > %macro a; > > > %do i=1 %to 100; > > > ods output ANOVA = anovax; > > > ods output FitStatistics = fitx; > > > ods output ParameterEstimates = parmx; > > > proc reg data=share; > > > model share&i=sp500; > > > run; > > > ods output close; > > > ods output close; > > > ods output close; > > > %end; > > > %mend a; > > > %a; > > > > > Macro is not a problem but the time consumption for prog reg 10,000 > > > > times. > > > > The following macro takes about 2 sconds for each proc reg. > > > > If you have faster method to do this, I would want to know. > > > > > %macro a; > > > > %do i=1 %to 100; > > > > proc reg data=share; > > > > model share&i=sp500; > > > > run; > > > > %end; > > > > %mend a; > > > > %a;- $B0zMQ%F%-%9%H$rI=<($7$J$$(B - > > > > - $B0zMQ%F%-%9%H$rI=<((B -- $B0zMQ%F%-%9%H$rI=<($7$J$$(B - > > > > - $B0zMQ%F%-%9%H$rI=<((B - > > > Thank you. > > I do realize ods is good tool but for 10,000 iteration, I am looking > > for better solution. > > I am thinking about Proc corr and proc means combination now. > > > Kaz- Hide quoted text - > > > - Show quoted text - > > There a better ways and non of them involve macro looping. > > < label: > MODEL dependents=<regressors> < / options > ; > > Notice that dependents is plural. > > Have you tried using the 10,000 variables on the left hand side of the > equation. > > proc reg; > model apple--ge = sp500; > output ....; > run; > > It might not work with 10,000 variables. RTFM for "sas variable list" > and MODEL statement in PROC REG. > > OR rearrange the data so you call PROC REG one time BY SHARE. > > The new data will have variables. > > Share (ge, microsoft, apple); > Y (the values currectnly stored in ge microsoft etc.) > SP500 (same) > > proc reg; > by share; > model y = sp500; > output ..... > run;- $B0zMQ%F%-%9%H$rI=<($7$J$$(B - > > - $B0zMQ%F%-%9%H$rI=<((B - Thank you everyone. I finally achieved by using Proc corr with cov option and proc means with mean= and std=. I tried reg procedure but still takes long time and ods bit is a bit tricky too handle too. I will try multiple reg model method for other opportunities Kaz
First
|
Prev
|
Pages: 1 2 Prev: use work data in/out sas EG stored process Next: Features of Project-drive.net |