LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (June 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 9 Jun 2009 19:30:50 +0800
Reply-To:     Murphy Choy <goladin@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Murphy Choy <goladin@GMAIL.COM>
Subject:      Re: Sampling without replacement
Comments: To: karma <dorjetarap@googlemail.com>
In-Reply-To:  <c6b899fd0906090421o54b7ab3qaf43bf9e06fb4727@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi Karma,

The following will do as well for samples of equal size. The one I was sending above was for just 3 sample without thinking about sample size.

*data a b c; set temp;

if ranuni(54321) <= 0.33 then output a;

else do;

if ranuni(54321) <= 0.5 then output b; else output c;

end;

run;*

As well as this,

*data a b c; set temp;

if ranuni(12345) <= 0.33 then output a; else if ranuni(12345) <= 0.5 then output b; else output c;

run;*

Regards, Murphy

On Tue, Jun 9, 2009 at 7:21 PM, Murphy Choy <goladin@gmail.com> wrote:

> Hi Karma, > > Agreed. I am merely suggesting a possibility. > > Regards, > Murphy > > > On Tue, Jun 9, 2009 at 6:20 PM, karma <dorjetarap@googlemail.com> wrote: > >> Hi Murphy, >> >> I think you should store the results of ranuni in a temp variable >> before splitting the dataset as calling the ranuni function again will >> return a new value. Otherwise dataset c will on average contain only >> half the number of the records in dataset b. >> >> >> data a b c; >> set Multi_Strat1_List; >> _temp = ranuni(12345) ; >> if _temp <= 0.33 then output a; >> else if _temp <= 0.66 then output b; >> else output c; >> run ; >> >> >> >> 2009/6/9 Murphy Choy <goladin@gmail.com>: >> > Hi, >> > >> > Why not use data step? >> > >> > data a b c; >> > set Multi_Strat1_List; >> > >> > if ranuni(12345) <= 0.33 then output a; >> > else if ranuni(12345) <= 0.66 then output b; >> > else output c; >> > >> > run; >> > >> > Regards, >> > Murphy >> > >> > On Tue, Jun 9, 2009 at 5:39 PM, fabergoogle >> > <fabrizio_marrama@bradycorp.com>wrote: >> > >> >> Hi all, >> >> >> >> I want to create 3 different samples whose union should give me back >> >> the whole dataset. >> >> Therefore an individual can only belong to one of those 3 samples. He >> >> cannot appear in any of the other two samples. >> >> I applied the proc surveyselect specifying rep=3. I noticed that an >> >> individual is present in 2 samples. Why? >> >> >> >> How can I have 3 different samples? >> >> >> >> Thank you. >> >> >> >> >> >> PROC SURVEYSELECT data = Multi_Strat1_List >> >> out = Multi_Strat1_Control_Sample >> >> method = srs >> >> rep=3 >> >> seed = 735119000 >> >> sampsize = 500; >> >> strata Deciles ContRev_Band; >> >> RUN; >> >> >> > >> > >> > >> > -- >> > Regards, >> > Murphy Choy >> > >> > Certified Advanced Programmer for SAS V9 >> > Certified Basic Programmer for SAS V9 >> > DataShaping Certified SAS Professional >> > >> > > > > -- > Regards, > Murphy Choy > > Certified Advanced Programmer for SAS V9 > Certified Basic Programmer for SAS V9 > DataShaping Certified SAS Professional >

-- Regards, Murphy Choy

Certified Advanced Programmer for SAS V9 Certified Basic Programmer for SAS V9 DataShaping Certified SAS Professional


Back to: Top of message | Previous page | Main SAS-L page