Date: Sat, 26 Jan 2008 02:22:33 -0800
Reply-To: BruceBrad <BruceBrad@INAME.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: BruceBrad <BruceBrad@INAME.COM>
Organization: http://groups.google.com
Subject: Creating Bootstrap replicates for clustered data
Content-Type: text/plain; charset=ISO-8859-1
I'm trying to modify the SAS %boot macro to do simple bootstrap
replication with clustered data. Eg I have multiple observations per
person, and want to resample people rather than observations. I wrote
the following test code. The "where" statement doesn't work - it seems
I can only use variables in the file being subsetted.
Any other suggestions? I don't think proc surveyselect can do this.
* Create test data;
%let Nclusters=10;
data datain (index=(cluster) sortedby=cluster);
do cluster = 1 to &nclusters;
do case = 1 to ceil(ranuni(0)*5); /* 1 to 5 cases per cluster */
output;
end;
end;
run;
* Create replicate dataset;
data bootdata/view=bootdata;
do sample=1 to 100;
do _i =1 to &nclusters;
_p = ceil(ranuni(0)*&nclusters);
set datain (where=(cluster=_p));
output;
end;
end;
run;