Sampling Steps

How to:

Sampling consists of the following steps, each of which will be described in detail:

  1. Selecting the sampling technique to be executed:
  2. Defining the sampling parameters. For each of the sampling techniques, identify the population size to be sampled and then use either of two available modes to determine the optimal sample size:
  3. Executing the report.

    To confirm the number of records included in the sample extract, you can run the procedure with the Message Viewer on. This provides both the selected output and the messages confirming the sample that was extracted. For information on how to turn the Message Viewer on, see How to Set Message Viewer On.


Top of page

x
Procedure: How to Extract a Sample Using Random Sampling in App Studio

To extract a sample using random sampling functionality:

  1. In the Report canvas, add the fields to be included in the sample extract.
  2. On the Modeling tab, in the Modeling group, click Sampling.

    The Sampling dialog box opens.

  3. Select the Random radio button for the sampling technique, as shown in the following image.

    Sampling dialog box

  4. Identify the population size by clicking the Retrieve Population button to retrieve the current total record count. The current record count will be displayed on the retrieve button, as shown in the image below. The sample size within the calculator will automatically be updated with the recommended sample size for the population size based on the defined margin of error, confidence level, and response distribution.

    Sampling dialog box

  5. Using the Population drop-down list, define which population will be used to determine the sample size.
    • Live. Select Live from the Population drop-down list to cause the total record count to be recalculated at run time. Live is the default value.
    • Design-Time Count. When you retrieve the population size during design time using the Retrieve Population button, the value identified is added to the population drop-down list. You can select this as your population size for the run-time execution. Use this if you are certain the population will not change between executions or if an estimate is sufficient for your circumstances.
    • User-defined Count. Enter any value for population by typing a numeric value into the Population list box. Note that the Recommended Sample Size automatically updates as you type new values for the population size, as shown in the image below.

      Sampling dialog box

  6. Define the seed value by using the default seed value or by typing a new value into the Seed input box to be used to generate the random sample.
  7. Select how the sample size will be defined by selecting one of the following options:

    Calculate Sample Size

    1. Click the Calculate Sample Size radio button to activate the sample calculator.
    2. Use the provided default values or type new values for:
      • Margin of Error (default value is 5).
      • Confidence Level (default value is 95).
      • Response Distribution (default value is 50).

      The Recommended Sample Size will be calculated and displayed, as shown in the image below.

      Sampling dialog box

    Specify Sample Size

    Click the Specify Sample Size radio button to specify a user-defined sample size.

    • To specify the sample size as a count, type a numeric value into the User Specified Sample Size input box.

      The Expected Margin of Error, based on the identified Population size and your specified Sample size, will be displayed, as shown in the image below.

      Sampling dialog box

    • To specify the sample size as a percent, click the As a percent check box, and enter the User Specified Sample Size as a number between 1 and 100 to represent the percentage of the overall population to be used as the sample.

      The Expected Margin of Error based on the identified Population size and your specified Sample size will be displayed.

  8. To execute the extraction with the defined random sampling, close the Sampling dialog box by clicking OK and run the report.

Top of page

x
Procedure: How to Extract a Sample Using Random Sampling in Developer Studio

To extract a sample using random sampling functionality:

  1. Using Report Painter, add the fields to be included in the sample extract to the Report Painter window.
  2. Either select Sampling from the Report menu or click the Options button on the output format toolbar.
    • If you choose Sampling from the Report menu, the Report Options dialog box opens to the Sampling tab.
    • If you click the Options button on the output format toolbar, the Report Options dialog box opens to the Output tab and you need to select the Sampling tab.
  3. Select the Random radio button for the sampling technique, as shown in the following image.

    Retrieve Population button

  4. Identify the population size by clicking the Retrieve Population button to retrieve the current total record count. The current record count will be displayed on the retrieve button, as shown in the image below. The sample size within the calculator will automatically be updated with the recommended sample size for the population size based on the defined margin of error, confidence level, and response distribution.

    Population drop-down box

  5. Using the Population drop-down list, define which population will be used to determine the sample size.
    • Live. Select Live from the Population drop-down list to cause the total record count to be recalculated at run time. Live is the default value.
    • Design-Time Count. When you retrieve the population size during design time using the Retrieve Population button, the value identified is added to the population drop-down list, as shown in the following image. You can select this as your population size for the run-time execution. Use this if you are certain the population will not change between executions or if an estimate is sufficient for your circumstances.

      Design-Time Count in population drop-down list

    • User-defined Count. Enter any value for population by typing a numeric value into the Population list box. Note that the Recommended Sample Size automatically updates as you type new values for the population size, as shown in the image below.

      Seed input box

  6. Define the seed value by using the default seed value or by typing a new value into the Seed input box to be used to generate the random sample.
  7. Select how the sample size will be defined by selecting one of the following options:

    Calculate Sample Size

    1. Click the Calculate Sample Size radio button to activate the sample calculator.
    2. Use the provided default values or type new values for:
      • Margin of Error (default value is 5).
      • Confidence Level (default value is 95).
      • Response Distribution (default value is 50).

      The Recommended Sample Size will be calculated and displayed, as shown in the image below.

      Recommended Sample Size

    Specify Sample Size

    Click the Specify Sample Size radio button to specify a user-defined sample size.

    • To specify the sample size as a count, type a numeric value into the User Specified Sample Size input box.

      The Expected Margin of Error, based on the identified Population size and your specified Sample size, will be displayed, as shown in the image below.

      Expected Margin of Error

    • To specify the sample size as a percent, click the As a percent check box, and enter the User Specified Sample Size as a number between 1 and 100 to represent the percentage of the overall population to be used as the sample.

      The Expected Margin of Error based on the identified Population size and your specified Sample size will be displayed.

  8. To execute the extraction with the defined random sampling, close the Sampling dialog box by clicking OK and run the report.

Top of page

x
Procedure: How to Extract a Sample Using Numeric Stratified Sampling in App Studio

To extract a sample using numeric stratified sampling based on user-defined ranges of a numeric field within the data:

  1. In the Report canvas, add the fields to be included in the sample extract.
  2. On the Modeling tab, in the Modeling group, click Sampling.

    The Sampling dialog box opens.

  3. Select the Numeric Stratified radio button for the sampling technique, as shown in the image below.

    Sampling dialog box

  4. From the list of available numeric fields in the current report, select the field to be used to define the stratum criteria, as shown in the following image.

    Sampling dialog box

    Each stratum or group is defined by the upper limit for the data value of the current field. Strata are selected in the order they are defined. Therefore, the criteria must be entered in ascending order. In the example below, we will divide our population into four strata based on the values for Profit.

    Strata

    Criteria Value Entered

    Who Qualifies

    Stratum 1

    5000

    -∞ Profit ≤ 5000

    Stratum 2

    10000

    5000 < Profit ≤ 10000

    Stratum 3

    50000

    10000 < Profit ≤ 50000

    Stratum 4

    999999

    50000 < Profit ≤ 999999

    Note:

    • Numeric strata criteria must be entered in ascending order to return the correct results.
    • Any data values that fall outside of the defined criteria ranges will not be included in the sample selection.

  5. Use the strata toolbar to manage your strata criteria. The strata toolbar is shown in the following image:

    • To add a new stratum, either double-click in the next available criteria cell or click the New icon.
      • Enter each criteria value. Press Enter to close the current row and add the new criteria row.
    • To remove strata criteria, select the row to delete and click the X (delete) icon on the toolbar or close the edit box for the strata criteria with an empty value.
    • To rearrange the order of strata criteria, use the move item up and move item down icons to arrange the strata criteria in ascending order.

      The example of strata criteria is shown in the following image.

      Sampling dialog box

  6. Once your strata are defined, click the Retrieve Population button to identify the record count and calculate the recommended sample size for each defined stratum, as shown in the following image.

    Sampling dialog box

  7. For each stratum, you can choose from the following options to define the overall population from which to select your sample.
    • Live. Select Live from the population drop-down list to cause the record count to be recalculated at run time. Live is the default value.
    • Design-Time Count. When you retrieve the population size during design time using the Retrieve Population button, the value identified is added to the population drop-down list, as shown in the following image. You can select this as your population size for the run-time execution. Use this if you are certain the population will not change between executions or if an estimate is sufficient for your circumstances.

      Sampling dialog box

    • User-defined Count. Enter any value for population by typing a numeric value into the Population list box. Note that the Recommended Sample Size automatically updates as you type new values for the population size.
  8. Select how the sample size will be defined by selecting one of the following options:

    Calculate Sample Size

    1. Click the Calculate Sample Size radio button to activate the sample calculator. By default, the Calculate Sample Size radio button is selected and the sample calculator is active.
    2. Use the provided default values or type new values for:
      • Margin of Error (default value is 5).
      • Confidence Level (default value is 95).
      • Response Distribution (default value is 50). Response Distribution is defined at the stratum level.

        Note: The value defined in the calculator is used as the default value when new stratum are created. If you want to change the default to be used each time you create a new criteria row, set the default value within the Default Response Distribution field box.

      The Recommended Sample Size will be calculated and displayed, as shown in the image below.

      Sampling dialog box

    Specify Sample Size

    Click the Specify Sample Size radio button, as shown in the following image.

    By default, each of the stratum sample sizes is set to the value of 1, which is the minimum value allowed.

    Sampling dialog box

    The sample size can be specified as a count or as a percentage of each stratum population.

    • To specify the sample size as a count, type a numeric value into the Sample Size cell in the Strata grid for each stratum in your sample, as shown in the following image.

      Sampling dialog box

    • To specify the sample size as a percent, click the As a percent of the population check box. Within the Stratum grid, type a numeric value between 0 and 100 to represent the percentage of the total records in the current stratum that should be included. This number should represent the proportion of the individual stratum, not the overall population.

    Note: Click the Retrieve Population button to refresh and calculate the Expected Margin of Error based on the identified Population size and your overall strata sample sizes.

  9. To execute the extraction with the defined Numeric Stratified Sampling, close the Sampling dialog box by clicking OK and run the report.


x
Procedure: How to Extract a Sample Using Numeric Stratified Sampling in Developer Studio

To extract a sample using numeric stratified sampling based on user-defined ranges of a numeric field within the data:

  1. Using Report Painter, add the fields to be included in the sample extract to the Report Painter window. Be sure that the field you will be using to define the strata is included in the report.
  2. Either select Sampling from the Report menu or click the Options button on the output format toolbar.
    • If you choose Sampling from the Report menu, the Report Options dialog box opens to the Sampling tab.
    • If you click the Options button on the output format toolbar, the Report Options dialog box opens to the Output tab and you need to select the Sampling tab.
  3. Select the Numeric Stratified radio button for the sampling technique, as shown in the image below.

    Numeric Stratified option button

  4. From the list of available numeric fields in the current report, select the field to be used to define the stratum criteria, as shown in the following image.

    Stratum Field drop-down list box

    Each stratum or group is defined by the upper limit for the data value of the current field. Strata are selected in the order they are defined. Therefore, the criteria must be entered in ascending order. In the example below, we will divide our population into four strata based on the values for Profit.

    Strata

    Criteria Value Entered

    Who Qualifies

    Stratum 1

    5000

    -∞ Profit ≤ 5000

    Stratum 2

    10000

    5000 < Profit ≤ 10000

    Stratum 3

    50000

    10000 < Profit ≤ 50000

    Stratum 4

    999999

    50000 < Profit ≤ 999999

    Note:

    • Numeric strata criteria must be entered in ascending order to return the correct results.
    • Any data values that fall outside of the defined criteria ranges will not be included in the sample selection.

  5. Use the strata toolbar to manage your strata criteria. The strata toolbar is shown in the following image:

    • To add a new stratum, either double-click in the next available criteria cell or click the New icon.
      • Enter each criteria value. Press Enter to close the current row and add the new criteria row.
    • To remove strata criteria, select the row to delete and click the X (delete) icon on the toolbar or close the edit box for the strata criteria with an empty value.
    • To rearrange the order of strata criteria, use the move item up and move item down icons to arrange the strata criteria in ascending order.

      The example of strata criteria is shown in the following image.

      Strata Criteria

  6. Once your strata are defined, click the Retrieve Population button to identify the record count and calculate the recommended sample size for each defined stratum, as shown in the following image.

    Retrieve Population button

  7. For each stratum, you can choose from the following options to define the overall population from which to select your sample.
    • Live. Select Live from the population drop-down list to cause the record count to be recalculated at run time. Live is the default value.
    • Design-Time Count. When you retrieve the population size during design time using the Retrieve Population button, the value identified is added to the population drop-down list, as shown in the following image. You can select this as your population size for the run-time execution. Use this if you are certain the population will not change between executions or if an estimate is sufficient for your circumstances.

      User-defined Count Population list box

    • User-defined Count. Enter any value for population by typing a numeric value into the Population list box. Note that the Recommended Sample Size automatically updates as you type new values for the population size.
  8. Select how the sample size will be defined by selecting one of the following options:

    Calculate Sample Size

    1. Click the Calculate Sample Size radio button to activate the sample calculator. By default, the Calculate Sample Size radio button is selected and the sample calculator is active.
    2. Use the provided default values or type new values for:
      • Margin of Error (default value is 5).
      • Confidence Level (default value is 95).
      • Response Distribution (default value is 50). Response Distribution is defined at the stratum level.

        Note: The value defined in the calculator is used as the default value when new stratum are created. If you want to change the default to be used each time you create a new criteria row, set the default value within the Default Response Distribution field box.

      The Recommended Sample Size will be calculated and displayed, as shown in the image below.

      Recommended Sample Size

    Specify Sample Size

    Click the Specify Sample Size radio button, as shown in the following image.

    By default, each of the stratum sample sizes is set to the value of 1, which is the minimum value allowed.

    Specify Sample Size option button

    The sample size can be specified as a count or as a percentage of each stratum population.

    • To specify the sample size as a count, type a numeric value into the Sample Size cell in the Strata grid for each stratum in your sample, as shown in the following image.

      Sample Size text box

    • To specify the sample size as a percent, click the As a percent of the population check box. Within the Stratum grid, type a numeric value between 0 and 100 to represent the percentage of the total records in the current stratum that should be included. This number should represent the proportion of the individual stratum, not the overall population.

    Note: Click the Retrieve Population button to refresh and calculate the Expected Margin of Error based on the identified Population size and your overall strata sample sizes.

  9. To execute the extraction with the defined Numeric Stratified Sampling, close the Sampling dialog box by clicking OK and run the report.


x
Procedure: How to Extract a Sample Using Categorical Stratified Sampling in App Studio

To extract a sample using categorical stratified sampling based on alphanumeric categories within the data:

  1. In the Report canvas, add the fields to be included in the sample extract.
  2. On the Modeling tab, in the Modeling group, click Sampling.

    The Sampling dialog box opens.

  3. Select the Categorical Stratified radio button for the sampling technique, as shown in the following image.

    Sampling dialog box

  4. From the list of available fields in the current report, select the field to be used to define the stratum criteria.

    Note that all fields (character and numeric) that you selected for your report are available within the Stratum Field drop-down list.

    Sampling dialog box

  5. Click the Get Data button to retrieve the values of the field selected. This retrieves all available values for your stratum field and makes them available for selection as your stratum criteria.
  6. Use the strata toolbar to manage your strata criteria. The strata toolbar is shown in the following image:

    • To add a new stratum, either double-click in the first criteria cell or click the New icon and select a value from the drop-down list.
      • Enter each criteria value or select the value from the drop-down list. Press Enter to close the current row and add a new criteria row.
    • To remove strata criteria, select the row to delete and click the X (delete) icon on the toolbar or close the edit box for the strata criteria with an empty value.
    • To rearrange the order of strata criteria, use the move item up and move item down icons to arrange the strata criteria.

      The example of strata criteria is shown in the following image.

      Sampling dialog box

    • Note: Any data values that fall outside of the defined criteria will not be included in the sample selection.
  7. Click the Retrieve Population button to identify the record count and calculate the Recommended Sample Size for each defined stratum.

    Sampling dialog box

  8. For each stratum, you can choose from the following options to define the population to use to extract your sample.
    • Live. Select Live from the population drop-down list to recalculate the record count at run time. Live is the default value.
    • Design-Time Count. When you retrieve the population size during design time using the Retrieve Population button, the value identified is added to the population drop-down list, as shown in the following image. You can select this as your population size for the run-time execution. Use this if you are certain the population will not change between executions or if an estimate is sufficient for your circumstances.

      Sampling dialog box

    • User-defined Count. Enter any value for population by typing a numeric value into the Population list box. Note that the Recommended Sample Size automatically updates as you type new values for the population size.
  9. Select how the sample size will be defined by selecting one of the following options:

    Calculate Sample Size

    1. Click the Calculate Sample Size radio button to activate the sample calculator. By default, the Calculate Sample Size radio button is selected and the sample calculator is active.
    2. Use the provided default values or type new values for:
      • Margin of Error (default value is 5).
      • Confidence Level (default value is 95).
      • Response Distribution (default value is 50). Response Distribution is defined at the stratum level.

        Note: The value defined in the calculator is used as the default value when new stratum are created. If you want to change the default to be used each time you create a new criteria row, set the default value within the Default Response Distribution field box.

      The Recommended Sample Size will be calculated and displayed, as shown in the image below.

      Sampling dialog box

    Specify Sample Size

    Select the Specify Sample Size radio button, as shown in the following image.

    By default, each of the stratum sample sizes is set to the value of 1, which is the minimum value allowed.

    Sampling dialog box

    The sample size can be specified as a count or as a percentage of the overall population.

    • To specify the sample size as a count, type a numeric value into the Sample Size cell in the Strata grid for each stratum in your sample, as shown in the following image.

      Sampling dialog box

    • To specify the sample size as a percent, click the As a percent of the population check box. Within the Stratum grid, type a numeric value between 0 and 100 to represent the percentage of the total records in the current stratum that should be included. This number should represent the proportion of the individual stratum, not the overall population.

      Note: Click the Retrieve Population button to refresh and calculate the Expected Margin of Error based on the identified Population size and your overall strata sample sizes.

  10. To execute the extraction with the defined Numeric Stratified Sampling, close the Sampling dialog box by clicking OK and run the report.

Top of page

x
Procedure: How to Extract a Sample Using Categorical Stratified Sampling in Developer Studio

To extract a sample using categorical stratified sampling based on alphanumeric categories within the data:

  1. Using Report Painter, add the fields to be included in the sample extract to the Report Painter window. Be sure that the field you will be using to define the stratum is included in the report.
  2. Either select Sampling from the Report menu or click the Options button on the output format toolbar.
    • If you choose Sampling from the Report menu, the Report Options dialog box opens to the Sampling tab.
    • If you click the Options button on the output format toolbar, the Report Options dialog box opens to the Output tab and you need to select the Sampling tab.
  3. Select the Categorical Stratified radio button for the sampling technique, as shown in the following image.

    Categorical Stratified option button

  4. From the list of available fields in the current report, select the field to be used to define the stratum criteria.

    Note that all fields (character and numeric) that you selected for your report are available within the Stratum Field drop-down list, as shown in the following image.

    Stratum Field drop-down list

    The image below shows that the Plant field was selected to be used to define the stratum criteria.

    Get Data button

  5. Click the Get Data button to retrieve the values of the field selected. This retrieves all available values for your stratum field and makes them available for selection as your stratum criteria.
  6. Use the strata toolbar to manage your strata criteria. The strata toolbar is shown in the following image:

    • To add a new stratum, either double-click in the first criteria cell or click the New icon and select a value from the drop-down list.
      • Enter each criteria value or select the value from the drop-down list. Press Enter to close the current row and add a new criteria row.
    • To remove strata criteria, select the row to delete and click the X (delete) icon on the toolbar or close the edit box for the strata criteria with an empty value.
    • To rearrange the order of strata criteria, use the move item up and move item down icons to arrange the strata criteria.

      The example of strata criteria is shown in the following image.

      Move item up/down icons

    • Note: Any data values that fall outside of the defined criteria will not be included in the sample selection.
  7. Click the Retrieve Population button to identify the record count and calculate the Recommended Sample Size for each defined stratum, as shown in the following image.

    Calculated Recommended Sample Size

  8. For each stratum, you can choose from the following options to define the population to use to extract your sample.
    • Live. Select Live from the population drop-down list to recalculate the record count at run time. Live is the default value.
    • Design-Time Count. When you retrieve the population size during design time using the Retrieve Population button, the value identified is added to the population drop-down list, as shown in the following image. You can select this as your population size for the run-time execution. Use this if you are certain the population will not change between executions or if an estimate is sufficient for your circumstances.

      Population list box

    • User-defined Count. Enter any value for population by typing a numeric value into the Population list box. Note that the Recommended Sample Size automatically updates as you type new values for the population size.
  9. Select how the sample size will be defined by selecting one of the following options:

    Calculate Sample Size

    1. Click the Calculate Sample Size radio button to activate the sample calculator. By default, the Calculate Sample Size radio button is selected and the sample calculator is active.
    2. Use the provided default values or type new values for:
      • Margin of Error (default value is 5).
      • Confidence Level (default value is 95).
      • Response Distribution (default value is 50). Response Distribution is defined at the stratum level.

        Note: The value defined in the calculator is used as the default value when new stratum are created. If you want to change the default to be used each time you create a new criteria row, set the default value within the Default Response Distribution field box.

      The Recommended Sample Size will be calculated and displayed, as shown in the image below.

      Recommended Sample Size

    Specify Sample Size

    Select the Specify Sample Size radio button, as shown in the following image.

    By default, each of the stratum sample sizes is set to the value of 1, which is the minimum value allowed.

    Specify Sample Size option button

    The sample size can be specified as a count or as a percentage of the overall population.

    • To specify the sample size as a count, type a numeric value into the Sample Size cell in the Strata grid for each stratum in your sample, as shown in the following image.

      As a percent of the population check box

    • To specify the sample size as a percent, click the As a percent of the population check box. Within the Stratum grid, type a numeric value between 0 and 100 to represent the percentage of the total records in the current stratum that should be included. This number should represent the proportion of the individual stratum, not the overall population.

      Note: Click the Retrieve Population button to refresh and calculate the Expected Margin of Error based on the identified Population size and your overall strata sample sizes.

  10. To execute the extraction with the defined Numeric Stratified Sampling, close the Sampling dialog box by clicking OK and run the report.

Top of page

x
Procedure: How to Set Message Viewer On

To confirm the number of records included in the sampled extract, you can run the procedure with the Message Viewer on. This provides both the selected output and the messages confirming the sample that was extracted.

In App Studio, select Message Viewer ON from the Run menu within the Application menu, as shown in the following image.

Application Menu

In Developer Studio, select Message Viewer ON from the Run drop-down menu, as shown in the following image.

Run drop-down menu

This provides both the selected output and the messages confirming the sample that was extracted.

The image below shows the output from the random sample defined in How to Extract a Sample Using Random Sampling in Developer Studio.

Message Viewer output


Top of page

x
Procedure: How to Disable Sampling

By default, sampling is set to disabled. To select a sampling technique, change the state of the Sampling radio button.

Important: To remove sampling definitions that you have previously defined, change the Sampling technique back to Disable Sampling. The current sampling definitions are retained in the current procedure (fex), until you save the procedure, but not used during report execution. Once you save a procedure with sampling disabled, any previously defined settings are removed.


WebFOCUS