BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
MeasuringHealth
Fluorite | Level 6

Hi all, (I am using SAS Studio Release: 3.6 (Enterprise Edition), Engine 9)

 

I have computed the simple Standardized Response Mean (SRM) for my sample: mean/std=SRM. Now, I need to bootstrap this SRM to get the 95% confidence intervals. Unfortunately, the SRM is a function of the mean and standard deviation, so I am not able to simply use PROC MEANS with a BY statement. Or can I? What is the best way for me to do this??? I have little experience with macro writing...but am willing to learn if there is a simple macro to write.

 

Here is my code (again, my goal is to bootstrap the SRM variable, which is now in my output as a single observation):

 

/* ----------------------------------------------------------- */
/*     Bootstrapping the Standardized Response Mean (SRM)      */
/* ----------------------------------------------------------- */
PROC MEANS DATA=Sample noprint;
	VAR ChangeScore;
	OUTPUT out=preSRM mean(ChangeScore)=mean std(ChangeScore)=std;
RUN;
DATA SRM;
	SET preSRM;
	SRM=DIVIDE(mean,std);
RUN;

*NOW I NEED TO BOOTSTRAP THE SRM VARIABLE...;

Help!!!!

Thank you,

MeasuringHealth

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @MeasuringHealth and welcome to the SAS Support Communities!

 

  1. Create your bootstrap samples (not using a macro, see David L. Cassell's paper BootstrapMania!: Re-Sampling the SAS® Way).
  2. Compute the means and standard deviations using PROC SUMMARY (or PROC MEANS) with BY-group processing.
  3. Perform the SRM calculation in a DATA step based on the output dataset from step 2.
  4. Using PROC UNIVARIATE, determine the 2.5th and 97.5th percentile of the SRM values in the dataset resulting from step 3 in order to obtain the bootstrap 95% CI.

Alternatively, a single PROC SQL step (with a GROUP BY clause) could replace steps 2 and 3.

View solution in original post

4 REPLIES 4
stat_sas
Ammonite | Level 13

Hi,

 

Try this

 

data want;
if _n_=1 then set SRM;
set sample;
run;

MeasuringHealth
Fluorite | Level 6
Okay, I'll try...any hint on the code I should write after that?
FreelanceReinh
Jade | Level 19

Hi @MeasuringHealth and welcome to the SAS Support Communities!

 

  1. Create your bootstrap samples (not using a macro, see David L. Cassell's paper BootstrapMania!: Re-Sampling the SAS® Way).
  2. Compute the means and standard deviations using PROC SUMMARY (or PROC MEANS) with BY-group processing.
  3. Perform the SRM calculation in a DATA step based on the output dataset from step 2.
  4. Using PROC UNIVARIATE, determine the 2.5th and 97.5th percentile of the SRM values in the dataset resulting from step 3 in order to obtain the bootstrap 95% CI.

Alternatively, a single PROC SQL step (with a GROUP BY clause) could replace steps 2 and 3.

MeasuringHealth
Fluorite | Level 6

Thank you very much, @FreelanceReinh!!

 

I should have called upon you sooner. For anyone that may benefit from seeing it, here is my successful code (built by using @FreelanceReinh's suggestion):

 

/* ----------------------------------------------------------- */
/*     Bootstrapping the Standardized Response Mean (SRM)      */
/* ----------------------------------------------------------- */

/*--- Bootstrapping the samples ---*/
SASFILE SEVERITY load; /* 1 */
PROC SURVEYSELECT DATA=SEVERITY out=outboot /* 2 */
	SEED=1 /* 3 */
	METHOD=urs /* 4 */
	SAMPRATE=1 /* 5 */
	OUTHITS /* 6 */
	rep=1000; /* 7 */
RUN;
SASFILE SEVERITY close; /* 8 */

/*--- Compute means & standard deviations from bootstrap samples ---*/
PROC MEANS DATA=outboot noprint;
	BY Replicate;
	VAR GASIchange;
	OUTPUT out=preSRM mean(GASIchange)=mean std(GASIchange)=std;
RUN;

/*--- Perform SRM calculation on bootstrapped statistics ---*/
DATA bootSRM;
	SET preSRM;
	bootSRM=DIVIDE(mean,std);
RUN;

/*--- Compute 95% bootstrap confidence interval ---*/
PROC UNIVARIATE DATA=bootSRM;
	VAR bootSRM;
	HISTOGRAM bootSRM;
	OUTPUT out=Pctl pctlpre=CI95_
		pctlpts=2.5 97.5       
		pctlname=Lower Upper;
RUN;

Best,

MeasuringHealth

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1127 views
  • 3 likes
  • 3 in conversation