You are here: Commands > Sample

Sample

Menu: Found in the DATA menu

Use the Sample command to create a record or monetary unit sample (MUS) from a population within a table.

Note: Sample parameters will vary depending on the sample type and sampling method chosen.

The Sample command supports a wide range of sampling activities. You can create record and monetary unit samples in combination with a number of sampling options to suit your needs:

Random sampling
Interval sampling
Fixed interval selection after random start
Cell sampling (random selection within each interval)
Conditional sampling with If, While, Next and First clauses

The sampling approach you choose depends on your assessment of the characteristics of the population you want to sample as well as your objectives and preferences.

Note: The maximum sample size that can be specified for random samples (Record or Monetary Unit Sampling) is 5000.

When choosing a sampling approach, it is useful to understand the affect of sampling bases and biases and methods on the results of each Analyzer sampling option. For more information see Sampling.

Note: Creating record output from a file that contains static and/or conditional static fields may yield unpredictable results. Be sure to select only the fields you want.

Note: When processing server files that contain related fields, record output will be changed to All fields output if you specify the local option or keyword.

Note: Sampling options will vary depending on the sampling method chosen.

Parameters

In addition to the command parameters described below, the Sample command has the following command parameters: Append, First, If, Next, Noformat, Open, To, and While. For a description of these parameters, see Command Parameters. For a description of supported field modifiers see Field Modifiers.

On

Specifies the numeric field or expression for monetary unit sampling (MUS). In the command dialog, simply select the numeric field from the “Field to Sample” drop-down list or click the [Choose] button to display the Selected Fields dialog. For information on the Selected Fields dialog, see Selection/Edit Dialog Boxes.

MUS

Specifies the monetary unit sampling type. In the command dialog, simply click the Monetary Unit radio button.

Record

Specifies the record sampling type. In the command dialog, simply click the Record radio button.

Fixed Interval

Specifies fixed interval sampling as the sampling method. In the command dialog choose Fixed Interval from the “Sample Parameters” pull-down list.

Note: Analyzer offers different sampling parameters depending on whether you choose Fixed Interval, Cell or Random options.

Cell

Specifies cell interval sampling as the sampling method. In the command dialog choose Cell from the “Sample Parameters” pull-down list.

Note: Analyzer offers different sampling parameters depending on whether you choose Fixed Interval, Cell or Random options.

Random

Specifies random sampling as the sampling method. In the command dialog, choose Random from the “Sample Parameters” pull-down list.

Note: Analyzer offers different sampling parameters depending on whether you choose Fixed Interval, Cell or Random options.

Interval

Specifies the interval value for Fixed Interval and Cell sampling. In the command dialog, enter the sampling interval in the “Interval” text box.

Start

Specifies the first record or monetary unit chosen in a Fixed Interval sample.

Cutoff

Specifies an amount for Fixed Interval and Cell sampling above which an item is considered “top stratum.” Top stratum items are automatically displayed and included in the sample. The default cutoff is the Interval size. In the command dialog, enter the cutoff value in the “Cutoff” text box.

Seed

Specifies the seed value for the random number generator for Cell and Random samples.

Size

Displays the Size dialog which you can use to determine appropriate sample sizes for use with record and MUS samples. Enter the appropriate parameter values and click [Calculate] to display the results. Click [OK] to return to the Sample dialog. All parameters you assigned in the Size dialog are carried over.

Note: The maximum sample size that can be specified for random samples (Record or Monetary Unit Sampling) is 5000.

Note: The Size button is only made available for MUS Fixed Interval sampling and all of the RECORD sampling types. This is because SIZE is meant to be used to determine a statistically valid sample size whose results can then be evaluated in the EVALUATE command. The EVALUATE command is only valid for samples drawn using MUS Fixed Interval sampling and all of the RECORD sampling types.

See Size for information on using the Size command.

Population

To ensure that all records or field values in the sampling population have an equal opportunity of selection, specify the total number of records in the file or the absolute value of the sampled field, as appropriate, as the population size. A population value is only available for Random sampling.

Note: If you choose some other population size, Analyzer informs you in the Command Log that the supplied population total differs from the actual total.

The default for MUS sampling is the absolute value of the field being sampled. The default for Record sampling is the record count for the file.

In the command dialog, enter the population in the “Population” text box.

The population is an optional parameter.

If not specified in the Sample command dialog or in the Sample command syntax, Analyzer will automatically calculate the population when the Sample command is run. This is useful when using Sample commands in procedures where the source file may change over time and you don't want to hard code a population value that would be incorrect if the underlying data was updated or refreshed.

Fields

Allows you to specify fields to be included in the output file. In the command dialog, simply click the [More] button, then click the “Fields” radio button in the Output Options and choose the fields from the list box or click the [Choose] button to display the Selected Fields dialog.

Noreplacements

Instructs Analyzer when performing MUS samples not to choose the same record more than once. Because Analyzer does not replace any selections omitted, fewer records or values may be displayed than expected. The default is repeats. In the command dialog, click the [More] button and choose the “Select Items Only Once” radio button in the Sample Options group box.

Order

Causes the selection order to be outputted as a field. Only used with Random Sampling to allow testing of items based on order selected. In the command dialog, click the [More] button and choose the “Report Selection Order” radio button in the “Sample Options” group box.

Subsample

Generates an extra field in the output file which contains a random number between zero and the field value of the selected item. This is useful when subsampling is required, for example, when a selected sample item is actually made up of a number of “smaller” items. Top stratum items have a Subsample amount of zero, facilitating alternative analyses on this population.

This is only available if you choose to output fields. The default is no subsample. In the command dialog, click the [More] button and choose the “Report Subsample Amount” radio button in the Sample Options group box.

Command Mode Syntax

SAMPLE <ON> RECORD¿

SAMPLE <ON> numeric-field-name

<SUBSAMPLE>

<CUTOFF top-stratum-cutoff>

<NOREPLACEMENT>¿

You can add the following options to the syntax above:

INTERVAL value FIXED start-value

<CELL> INTERVAL value RANDOM seed

RANDOM seed {NUMBER|SIZE} size POPULATION size <ORDER>

{<FIELDS> extract‑fields|RECORD}

TO data-file-name

<IF test> <WHILE test> <FIRST|NEXT range>

<NOFORMAT> <APPEND>

Examples

Much of an analyst’s work is performed on samples from a larger population.

To use the Sample command to derive a monetary unit sample (MUS) from an inventory value field in which:

An item is randomly chosen from every $30,000 dollar interval and
Every item greater than $25,000 is selected and
The entire record is included in the file named Inventory_MUS_Sample

Enter the following information:

1. From the Sample On drop-down list, select Value.
2. Select the Fixed Interval radio button.
3. In the Interval text box, enter 30000.
4. In the Start text box, enter 234.
5. In the Cutoff text box, enter 25000.
6. In the To text box, enter Inventory MUS Sample.

The Inventory_MUS_Sample file appears with the results.

Use the scroll bar to View the entire file. As is typical for MUS sampling, larger dollar values have been selected. The Command Log shows summary information on the sampling results.

The sample size is 22, with 3 top stratum items. Also displayed are the total of the population from which the sample was drawn, including a breakdown of that value between top stratum and other amounts and the initial selection point for the fixed interval sample.

In compliance testing, the dollar value of the items tested is not always relevant, so monetary unit sampling is not used.

To use the Sample command to derive a random record sample of 26 distinct items to test compliance of an inventory count, enter the following information:

1. Select Record as the Sample Type.
2. Select the Random radio button.
3. Specify a sample size of 26.
4. In the Start text box, enter 234.
5. In the To text box, enter Inventory Sample Items. Click [OK].

Note: Analyzer automatically lists the population size, in this case 152.

The file Inventory_Sample_Items reflects the items to be test counted. Use the scroll bar to View the entire file. The Command Log shows summary information on the sampling results.

The sample size is 26, with zero top stratum items. Also displayed is the total of the population from which the sample was drawn, including the start value for the random record sample.

Analyzer displays the sample size with the number of top stratum items as well as the total of the population from which the sample was drawn, including the start value for the random record sample. Once you have verified your sample you can use the Evaluate command to evaluate the data. For more information see Evaluate.