In Filemaker, this can be done easily by producing a report sub-summarized by State, with no body part. Use a summary field defined as Count of [any field that cannot be empty] to get the number of records in each state.
Your example seems to come up in a greek font for some reason, but I think you meant:
For I = 1 to N
A(I) = ...
Where A is an array and I is the index to the array.
If that's what you are asking, you have two basic approaches:
Use a repeating field or variable for A and use a second variable for the index.
Use a Field for I in a relationship to a table of related records. Incrementing I links the current record to the next related record.
On the other hand, your report example can be created as a summary report with subsummary parts and there is no need for any looping script or array at all...
Here's a link to a simple tutorial on setting up summary reports that you may find useful:
Creating Filemaker Pro summary reports--Tutorial