| Date: | Thu, 5 Oct 2006 10:54:32 -0400 |
| Reply-To: | Bob_Abelson@HGSI.COM |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Bob_Abelson@HGSI.COM |
| Subject: | Re: Splitting data set |
|
| In-Reply-To: | <200610051406.k95Akg3i000838@mailgw.cc.uga.edu> |
| Content-Type: | text/plain; charset=us-ascii |
The RANUNI function will generate a uniform pseudorandom variable which
has values between 0 and 1. So, this is what you could do (untested);
data yourdata(drop=seed);
set yourdata;
retain seed 99; * using a seed bigger than zero allows you to
reproduce your results!;
subset = (ranuni(seed)>=0.5); * The variable SUBSET will be 0 or
1, with about a 50/50 split;
run;
Then you can select your subsets using the SUBSET variable.
Bob Abelson
HGSI
240 314 4400 x1374
bob_abelson@hgsi.com
Mary Beth Kaylor <witten_5@YAHOO.COM>
Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
10/05/2006 10:39 AM
Please respond to
Mary Beth Kaylor <witten_5@YAHOO.COM>
To
SAS-L@LISTSERV.UGA.EDU
cc
Subject
Splitting data set
Hi- I was just wondering if anyone could tell me how to split a dataset. I
am working with a subset of a large survey and want to build a model with
one half of the dataset and test it on the other. I want all those
participants who meet the requirements to be in one of the two sets, I
don't want a random sample. I was told to use the RANUNI command but am
unsure how to achieve my goal. Thank you for your time and help :)
|