Returns an INTEGER value that is the total number of selected records in the file or files you are using across break groups.
This procedure sorts all customers by state and then calculates the percentage of the total number of customers that are in each state. The COUNT-OF function provides the calculation with the number of customer records in the database.
r-cntof.p
FOR EACH Customer NO-LOCK BREAK BY Customer.State: DISPLAY Customer.CustNum Customer.Name Customer.SalesRep Customer.State. ACCUMULATE Customer.State (SUB-COUNT BY Customer.State). IF LAST-OF( Customer.State) THEN DISPLAY 100 * (ACCUM SUB-COUNT BY Customer.State Customer.State) / COUNT-OF(Customer.State) FORMAT "99.9999%" COLUMN-LABEL "% of Total!Customers". END. |