From: Ya Huang on
You changed 2 places in the original code, which caused trouble:

set new POINT = choice NOBS = 10;

The 10 has to be n, a variable used later.

PROC REG DATA = analysis NOPRINT outest= outests;
(KEEP= intercept x );

A ';' after outests break the line, which make it two separated statement,
and (KEEP= intercept x ) should be part of the proc reg statement. So
remove the ';'.

After fixing these two, the code will run.


On Fri, 26 Feb 2010 12:39:03 -0500, Rick Francis <rnfrancis(a)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
From: oloolo on
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(a)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
From: Rick Francis on
Okay, made the changes suggested by Ya Huang.

I should see an output data set by the name of PARMS, given the code, right?
My macro is not generating that dataset. Any thoughts?

Thank you!

Rick Francis


On Fri, 26 Feb 2010 13:15:42 -0500, Ya Huang <ya.huang(a)AMYLIN.COM> wrote:

>You changed 2 places in the original code, which caused trouble:
>
> set new POINT = choice NOBS = 10;
>
>The 10 has to be n, a variable used later.
>
> PROC REG DATA = analysis NOPRINT outest= outests;
> (KEEP= intercept x );
>
>A ';' after outests break the line, which make it two separated statement,
>and (KEEP= intercept x ) should be part of the proc reg statement. So
>remove the ';'.
>
>After fixing these two, the code will run.
>
>
>On Fri, 26 Feb 2010 12:39:03 -0500, Rick Francis <rnfrancis(a)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
From: "Data _null_;" on
On 2/26/10, Rick Francis <rnfrancis(a)utep.edu> wrote:
> Any thoughts?

Ditch the macro and use the SURVEYSELECT method mentiond by "oloolo".
From: Rick Francis on
One problem (I think) with surveyselect is the inability to manage fixed
effects with multiple levels. Hence, ultimately, I'll use GLM, with the
boostrapped standard errors. Surveyreg will handle the cluster issue with
the errors, but creates out of memory error message.

I am grateful for all the help!!!

Rick Francis


On Fri, 26 Feb 2010 13:16:42 -0500, oloolo <dynamicpanel(a)YAHOO.COM> wrote:

>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(a)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