chizotz at mchsi.com
chizotz at mchsi.com
Fri Aug 27 11:38:54 CDT 2004
John, I have to do this every year. The newspaper industry has a regulatory agency called ABC that requires Nth Factor sampling for audit purposes. They hand you a requirement such as "start with subscriber 112 and give me every 96th subscriber after that". This is from an unordered set of subscriber data, to end up with a random sample. The numbers they hand you are based on your total number of subscribers and will theoretically result in a random sample of subscribers sufficiently large enough to represent the entire set. Your client may want this for a similar reason. I'm sure you've already considered this but... It may not be the "best" approach, but I just create a temp table and then loop through the unordered data to the start row and save that and every Nth row after that to the temp table. It's straightforward and easy to maintain, and in my case it's fast enough to not be too concerned with efficiency (once a year, who cares how long it takes to run as long as it isn't for days or something). That may not be workable for your case though, if they want this on demand and to run very quickly and there are a large number of records. Ron > Does anyone have a strategy for pulling every Nth record? My client wants > to pull every 100th record into a dataset for analysis, to speed things up I > am guessing.