Date: Fri, 26 Feb 2010 13:16:42 -0500
Reply-To: oloolo <dynamicpanel@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: oloolo <dynamicpanel@YAHOO.COM>
Subject: Re: Basic Bootstrap Macro
bootstrap is most efficiently done via PROC SURVEYSELECT and your
regression model using BY statement.
prototype code is as following:
ods select none;
proc surveyselect data=new method=urs reps=2000 samprate=1
out=bssamp outhits;
run;
ods select all;
proc reg data=bssamp outest=beta noprint;
by Replicate;
model y=x;
run;
then you can summarize your Bootstrap estimates of statistics using the
beta dataset:
proc means data=beta mean stddev;
var intercept x stderr;
run;
On Fri, 26 Feb 2010 12:39:03 -0500, Rick Francis <rnfrancis@UTEP.EDU> wrote:
>Hey guys,
>
>Working to generate bootstrap estimates for standard errors from a simple
>OLS regression.
>
>Found a macro on the web, modified it as follows:
>
>**** Beg of Macro code ****;
>
>data new;
> input y x;
> cards;
> 2 6
> 3 6
> 5 7
> 7 9
> 1 4
> 2 9
> 2 8
> 2 9
> 1 9
> 4 10
> ;
>
>%MACRO boot;
> %DO i = 1 %to 100;
> DATA analysis;
> choice = RANUNI(&i);
> set new POINT = choice NOBS = 10;
> i+1;
> IF i > n THEN STOP;
> RUN;
> PROC REG DATA = analysis NOPRINT outest= outests;
> (KEEP= intercept x );
> MODEL y = x;
>
> PROC APPEND BASE = parms DATA = outests;
> RUN;
>
> %end;
>
> %mend;
> run;
>
>proc print data=parms;
>proc print data=outests;
>
> run;
>
>*** End of Macro Code ***;
>
>You should be able to paste this into the SAS editor, and hopefully you
find
>the same thing that I did: the macro will not execute.
>
>Not a lotta knowledge about macros, so any help is greatly appreciated!
>
>
>The original code from the web is as follows:
>
> %MACRO boot;
> %DO i = 1 %to 20;
> DATA analysis;
> choice = INT(RANUNI(23456+&i)*n)+1;
> SET alldata POINT = choice NOBS = n;
> j+1;
> IF j > n THEN STOP;
> RUN;
> PROC REG DATA = analysis NOPRINT OUTEST = outests
> (KEEP= intercep x1 x2 x3 x4 );
> MODEL y = x1 x2 x3 x4;
> RUN;
> PROC APPEND BASE = parms DATA = outests;
> RUN;
> %END;
> %MEND;
>
>The lack of initialization of the variable "j" doesn't make sense to me,
but
>again, not a lotta macro knowledge on my end.
>
>Thanks for any insight you may have!
>
>Rick Francis