> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of bbser
> Sent: Saturday, July 16, 2011 2:12 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: the "standard" code generating a sample
> I just realized I should have asked more specific questions about the
> standard code.
> So here we go:
> 1. What's the purpose of the if expression?
> 2. why do we need to this statement obsleft+(-1);
> 3. How does this algorithm avoid picking up the same obs more than once?
> Thank you.
You can find a lot of useful discussions if you search SAS-L archives (or Google) for "k of n sampling". There are many discussion of how this algorithm works.
Here is one from 1999 that does a reasonable discussion of how this algorithm works.
Hope this is helpful,
Bothell, WA USA