Skip to content

Instantly share code, notes, and snippets.

@mjdescy
Last active August 29, 2015 13:59
Show Gist options
  • Save mjdescy/10643896 to your computer and use it in GitHub Desktop.
Save mjdescy/10643896 to your computer and use it in GitHub Desktop.
ACL Script To Pull Random Attribute Sample
COMMENT Script: Pull random attribute sample.
COMMENT
Before using this script,
1. set the SampleSize variable;
2. replace "PopulationTable" with the population table name; and
3. replace "SampleTable" with the sample table name.
END
COMMENT Define sample size.
SampleSize = 77
COMMENT Pull sample.
OPEN PopulationTable
COUNT
IF COUNT1 > SampleSize SAMPLE ON RECORD NUMBER SampleSize POPULATION COUNT1 RECORD TO "SampleTable" OPEN
IF COUNT1 <= SampleSize EXTRACT RECORD TO "SampleTable" OPEN
DEFINE FIELD SampleID COMPUTED RECNO()
DEFINE FIELD SampleName COMPUTED "Sample Name"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment