Date: Thu, 26 Jul 2007 10:43:07 -0700
Reply-To: Val Krem <valkrem@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Val Krem <valkrem@YAHOO.COM>
Subject: Re: data selection
In-Reply-To: <403593359CA56C4CAE1F8F4F00DCFE7D0B0C8F4B@MAILBE2.westat.com>
Content-Type: text/plain; charset=iso-8859-1
Thank you very much for your help and important suggestions!.
On the same question I would like to split the data int to three data sets.
1. the top 25%
2. the bottom 25%,
3 the rest of the data set.
How do I do that again?
Thanks in advance
Val
Ed Heaton <EdHeaton@westat.com> wrote: Two points to consider.
First, floor(ranUni(0)*230) will produce an integer from zero through
229. ceil(ranUni(0)*230) will produce an integer from 1 through 230.
Second - and far more important - you will NEVER be able to duplicate
your results if you loose the sample you've pulled. That's because
ranUni(0) gets its seed from the system clock and you will never be able
to get that value. (Well, you can if you capture the seed. For that,
you will have to use Call ranUni().) I once had to give back quite a
bit of money and endure much hard feelings over that mistake. Use
ranUni(1) or ranUni(43250325) or something. Just not ranUni(0)!
Ed
Edward Heaton, Senior Systems Analyst,
Westat (An Employee-Owned Research Corporation),
1650 Research Boulevard, RW-4541, Rockville, MD 20850-3195
Voice: (301) 610-4818 Fax: (301) 294-3879
mailto:EdHeaton@Westat.com http://www.Westat.com
-----Original Message-----
From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]
On Behalf Of Gerhard Hellriegel
Sent: Wednesday, July 25, 2007 10:27 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: data selection
a idea, what you could try:
generate a random number between 1 and 230 something with
floor(ranuni(0)
*230); should do. To be sure that you don't have 0, test that.
Something like:
data a;
do i=1 to 200;
x=floor(ranuni(0)*230);
if x=0 then x=1;
set your.data point=x;
output;
end;
stop;
run;
might do that.
With that however, you cannot be sure that you have no duplicates!
Gerhard
On Wed, 25 Jul 2007 06:11:14 -0700, Val Krem wrote:
> Dear SAS Users,
>
>
> Assume I have the following data set;
> Family familiy_size;
> 1 14
> 2 25
> 3 9
> 4 100
> 5 19
> 6 51
> 7 12
>
> total number of family 7
> total number of records 230 ( the sum of all family size)
> I want to randomly select family until the total number of
records reach to 200.
> How do I do that?
> Any help is highly appreciated in advance
> Val
>
>
>---------------------------------
>Building a website is a piece of cake.
>Yahoo! Small Business gives you all the tools to get online.
---------------------------------
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search.