Date: Mon, 31 Dec 2001 16:13:55 -0500
Reply-To: "David L. Ward" <dward@SASHELP.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "David L. Ward" <dward@SASHELP.COM>
Subject: Re: Help with weighted test data
In-Reply-To: <5.1.0.14.2.20011231121829.00ade3a8@pop3.attglobal.net>
Content-Type: text/plain; charset="us-ascii"
All,
I was able to figure out how to get random, weighted data in the format I
described earlier. The trick was to use call rantbl to determine which
"buckets" to place the sums in. The code is like this:
call rantbl(seed,&diag,index);
sdiag[index]=sdiag[index]+int(ranuni(0)*2);
Where &diag represents a list of weights like .20,.30,.10,.15 etc. I put
this code in a loop and distributed a total of 10 patients over the 10
buckets according to this distribution. When I summed up all 5000 or so
records, the distribution matched my original percentage goals.
Again, happy new year!
David W
|