Statistics of Field Contents
`Briefly`

At times one needs to find out how often certain elements occur in the database, like for example Subject terms, Names, Classification symbols and other Notations, etc. That's what the "Statistics" method was developed for. 

`Prepare a new Pattern`
 Which fields to count, in what way?
A template is shown in the display field. One needs to specify in it the field tags for evaluation and a few other details. This then constitutes a "pattern" for a statistical evaluation. The template has sufficient comment to explain itself.
Save the pattern with Alt+9 , after which it can be applied to the current result set or any other results sets, even to the entrie database. The pattern is saved permanently in a file of type C-xyz.xCT. The second menu item is there to select from previously designed patterns:

`Select a Pattern`
 From previously prepared files
Patterns from earlier evaluations are preserved in files with names of the type C-xyz.ACT. Select one appropriate for the current purpose, to apply it or edit it.

`Evaluate Current Result Set`
  Apply the selected pattern  %#uwQ
  to the current result set:  
The name of the selected or newly prepared pattern is shown here in red. It can now be applied to the current result set, or even:

`Evaluate Entire Database`
Rather than a result set, you can also have the entire database evaluated. It works rather fast but depends on the size, of course. Use the Esc key to terminate the operation at any moment.

Special cases:

`Tag statistics`
The field tags may also be counted. This will reveal what tags have been used heavily or scarcely. This way, one will also discover the stray illegal tags! 
Tip: If youn want to find the records containing the illegal tags, start a full-text search and use the tag as search term, like for instance #22x if that's such a tag.

`Subfield count`
In like manner, the subfield codes within the field contents may be evaluated. 

Experts ask: And how does all this work? 
This reveals what files are playing a part in this game and what their role is.
The template file for a new pattern is CTT.RTF . Alt+9 saves it under the name entered in the NAM= command, with prefix C- and .xCT as suffix, which means C-ABC.MCT  if  M.CFG is the database's CFG. This file is preserved for later re-use of the same pattern. No new parameter file is generated, like in the TABLE method! For all configurations, the same files C-FI.APR and COUNT2.APR are employed.  
Drei FLEXe und eine Batchdatei werden für die Arbeiten gebraucht:

CTSTART.FLX : copies the display to the file C-abc.xCT and checks the chosen name for appropriateness.

CTPROD.FLX :  reads and interprets the selected .ACT file. The commands, like FLD=... etc., are copied into  #u variables. These will be used by the C-FI.APR export parameter file to process the result set or the databaseand produce a sortable file named COUNT.ALG . After this export has been completed, the  CT99.BAT will be executed:

CT99.BAT sorts the file COUNT.ALG and then calls SRCH.EXE to process the sorted file using the COUNT2.APR parameters (working with  A.CFG in any case). The resulting frequency list can be easily sorted in ascending or descending mode: the occurrence numbers are on the left and adjusted to 7 digits. CTPROD.FLX terminates by displaying COUNTU in the display field.

CTPICK.FLX makes the existing C-xyz.xCT files available for selection, the file picked by the user can be applied afterwards.

The method is invoked from the Export Menu ; displaying at first the file CT.RTF. The direct command  h ct  is also possible. A click on  HELP..HELP..HELP produces CTH.RTF - that's the text you are just reading. 
Tip: Enter  h ct.rtf  to see how the FLEXes are activated.

This model may be used as a pattern for the construction of similar applications, i.e., for other  types of standardized exports. Instead of the "C-" prefix, choose something else to avoid confusion.
The files CT.RTF and CTH.RTF can then be modified appropriately.

?Prepare a new Pattern=x var "X ctstart"`ins #uX9`h ctteng
?Select a Pattern=X ctpick
?Evaluate Current Result Set=x var ""\ins #uwF\exec X ctprod
?Evaluate Entire Database=x var "G"\ins #uwF\exec X ctprod
?Briefly=h ct
?Tags statistics=x var "K"\ins #uwS\exec X ctprod
?Subfield count=x var "T"\ins #uwS\exec X ctprod