The STATMIN function returns the earliest value in the current status list of a dimension or a dimension surrogate, or in a valueset.
Either a dimension or surrogate value or an INTEGER
that indicates the position of the value in the default status list of the dimension or surrogate. The return value varies depending on the dimension argument and the object receiving the return value. See "Automatic Data Type Conversion of Values Returned by STATMIN".
A text expression whose value is the name of a dimension, dimension surrogate, or valueset.
Automatic Data Type Conversion of Values Returned by STATMIN
The dimension value that STATMIN returns is converted, if necessary, to a number or a text value. For example, suppose the status of month
is limited to Jun95
to Dec95
, and Jun95
is the sixth month
value in the default status list. The value of STATMIN(month)
can be assigned either to a text variable, a numeric variable, or DATE variable.
The following statements
DEFINE textvar TEXT textvar = STATMIN(month) SHOW textvar
produce this output.
Jun95
In contrast, these statements
DEFINE intvar INTEGER intvar = STATMIN(month) SHOW intvar
produce this output.
6
Example 8-114 Using STATMIN in a Title
The following statements from a program use STATMIN to determine the earliest of the 10 months with the highest total sales.
LIMIT month TO TOP 10 BASEDON TOTAL(sales, month) SHOW JOINCHARS(STATMIN(month) ' is the earliest of the - ten months with the highest sales.') SHOW JOINCHARS( 'The months range from ' statmin(month) ' TO '- statmax(month) )
The preceding statements produce the following sales report.
May95 is the earliest of the ten months with the highest sales. The months range from May95 to Sep96
Example 8-115 Comparing to STATFIRST
In the following example, you can see the difference between STATMIN and STATFIRST, which returns the first value in the current status list.
Assume that you issue the following statements.
LIMIT month TO TOP 10 BASEDON TOTAL(sales, month) REPORT WIDTH 20 TOTAL(sales, month)
When the proceeding statements execute, the following report is produced.
MONTH TOTAL(SALES, MONTH) -------------- -------------------- Jul96 3,647,085.39 Jun96 3,458,438.30 Jul95 3,414,210.05 Aug96 3,246,601.97 Jun95 3,228,824.80 Sep96 3,215,883.93 May96 3,112,854.59 Aug95 3,044,694.29 Sep95 3,006,242.58 May95 2,908,539.45
Notice that the month
values in this report are arranged by decreasing sales rather than chronologically, and this is now the order in which they occur in the status list:
STATMIN gives the chronologically first value in the status (though it is positionally last) as illustrated in the following statement and output.
SHOW STATMIN(month) May95
STATFIRST gives the value that is positionally first in the status (though it is chronologically eighth) as illustrated in the following statement and output.
SHOW STATFIRST(month) Jul96