STATISTICS command

Used to calculate statistics for one or more numeric or datetime fields in the current ACL table.

Syntax

STATISTICS {<ON> field <...n>|ALL} <STD> <NUMBER n> <TO SCREEN|filename|PRINT> 
<IF test> <WHILE test> <{FIRST|NEXT} range> <APPEND>

Parameters

ON field | ALL

Specify one or more numeric or datetime fields to generate statistics for, or specify ALL to generate statistics for each of the numeric and datetime fields in the table. The ON parameter can be omitted.

STD

Optional. Calculates the standard deviation of the fields specified, in addition to the other statistics.

NUMBER n

Optional. Specifies the number of high and low values to retain during processing. The default value is 5.

TO SCREEN | filename | PRINT
  • Specify TO SCREEN to display the results in the ACL display area. This is the default output if the TO parameter is not specified.

  • Specify TO filename to write the results to a file. You must specify the filename value as a quoted string with the appropriate file extension. For example, specify the .TXT file extension to create a text file.

    For example: TO "Output.TXT"

    You can also specify an absolute or relative file path to an existing folder to write the file to.

    For example: TO "C:\Output.TXT" or TO "Results\Output.TXT"

  • Specify TO PRINT to send the results to the default printer.

IF test

Optional. Specifies a condition that must be met. The command is only executed on records that pass the test.

WHILE test

Optional. Specifies that the command should only be executed while a condition is true. The command processing terminates as soon as the specified test evaluates as false, or the end of the table is reached.

FIRST | NEXT range

Optional. Specify FIRST to start processing at the first record or NEXT to start processing at the currently selected record. Use the range value to specify the number of records to process.

APPEND

Optional. Specifies that command output should be appended to the end of an existing file instead of overwriting the existing file. You must ensure that the structure of the two files is identical when using this parameter, if maintaining a consistent file structure is important (e.g., when you are appending data to an existing ACL table), because ACL appends output to an existing file regardless of its structure.

ACL output variables

ABSn

Stores the absolute value calculated by the command.

AVERAGEn

Stores the mean value calculated by the command.

COUNTn

Stores the record count calculated by the command.

If the variable name is COUNT1, it is storing the record count for the most recent command executed.

If the variable name is COUNTn where n is greater than 1 the variable is storing the record count for a command executed within a GROUP command. The value of n is assigned based on the line number of the command in the GROUP. For example, if the command is one line below the GROUP command it is assigned the value COUNT2. If the command is four lines below the GROUP command, it is assigned the value COUNT5.

HIGHn

Stores the highest value identified by the command.

LOWn

Stores the lowest value identified by the command.

MAXn

Stores the largest value identified by the command.

MINn

Stores the smallest value identified by the command.

RANGEn

Stores the value of the difference between the largest and smallest values identified by the command.

STDDEVn

Stores the standard deviation value calculated by the command.

TOTALn

Stores the first total value calculated by the command. The value of n is 1 unless the TOTAL command is inside a GROUP command, in which case value of n corresponds to the line number of the TOTAL command in the GROUP command.

Example

The following example generates statistics for the Quantity field for records where the Product Class ID is ‘01’.

STATISTICS ON Qty IF ProdCls = "01"



(C) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback