Sampling logic is easily implemented with VISION:Excel. You simply define the sample you want, and then you place sampling logic statements into your program. For instance, suppose you want to do a random sample of 100 items out of a population of a 1000. First you define the sample, in code, as follows:
SAMPLE 01 RANDOM 1000 100
In this defining, non-executable statement, 1000 is the population size and 100 is the desired sample size. The 01 is a sampling application number. Up to 99 sampling applications can be defined in one VISION:Excel program. The defining statement for each sampling application requires a unique sampling application number.
The executable code is in the form of an IF SAMPLING statement. For example,
IF SAMPLING 01
Do the logic to accept an item into the sample
ELSE
Do the logic to reject an item from the sample
ENDIF
An example of a complete VISION:Excel sampling program follows:
FILE INFILE
FILE OUTFILE1 FB 400 OUTPUT FROM INFILE
FILE OUTFILE2 FB 400 OUTPUT FROM INFILE
SAMPLE 01 RANDOM 1000 100
SAMPLE 02 INTERVAL 50
IF SAMPLING 01 WRITE OUTFILE1 ENDIF
IF SAMPLING 02 WRITE OUTFILE2 ENDIF
This program simply creates a random sample file of 100 records read from the input file containing 1000 records and a second sample file that is composed of every 50th record from the input file.