HomeStartingEnvironmentDBMSVisualPQLProceduresSQLFormsHost/APIIndex
PQL Procedures homecontents start chapter top of pagebottom of pagenext page index Frequencies

Frequencies

The FREQUENCIES procedure produces frequency counts, histograms and descriptive statistics on numeric variables. Frequency counts show how many times a variable had a particular value, or had a value that fell within a specified range. There are four ways of categorising values:

INTEGER Produces counts for each discrete integer value. Used for categorical variables or other codes.

GENERAL Produces counts for each discrete value. The expected number of counts must be specified on the command. Used for non-integer numbers with a relatively low number of discrete values.

CONTINUOUS Counts the values that fall into each range. Specify a number of ranges within an overall range so that each range is equal. Used for variables with a large range of values.

INTERVALS Similar to CONTINUOUS except that each range is specified individually and may be unequal.

FREQUENCIES {INTEGER    = {varlist | ALL} (min,max)            |
             GENERAL    = {varlist | ALL} (categories)         |
             CONTINUOUS = {varlist | ALL} (categories,min,max) |
             INTERVALS  = {varlist | ALL} (intervals)}

  [ FILENAME   = filename ]
  [ STATISTICS = keywordlist ]
  [ WEIGHT     = varname ]
  [ TITLE      = 'text'  ]
  [ HISTOGRAM]
  [ ORDER ]
  [ NOLABELS  ]
  [ BOOLEAN    = (logical expression) ]
  [ SAMPLE     = fraction]
Specify one of INTEGER, GENERAL, CONTINUOUS or INTERVALS. This produces a frequency table with the specified number of entries. In addition a summary is printed giving counts of Included Observations (values in the frequency table), Missing Observations (missing and undefined values) and Rejected Observations (values outside the specified ranges).

INTEGER Specify the numbers to count. One entry is produced for each integer value in the range.

GENERAL Specify the number of discrete values to count.

CONTINUOUS Specify an overall range and a number of equal sub-ranges within this. Values that fall outside of the range are omitted from the frequencies table and are not included in the calculations of the statistics. Specify the overall range by min and max . This is divided into the specified number of equal sized ranges.

INTERVALS Specify a set of values, in increasing order, that represent the boundaries of the ranges in the frequency table. Values below the first and beyond the last value are omitted. For example, to create three ranges for Salary:
      FREQUENCIES INTERVALS =
                  SALARY (0,2000,3000,9999)

FILENAME Specify the filename created by the procedure.
If multiple FREQUENCIES statements are specified and no FILENAME clause is specified on a second or subsequent command, the output is written to the file specified on the previous command.
If no filename is specified, the output is written to the default output file (the scrolled output buffer in the case of interactive sessions).

STATISTICS Specify the statistics produced. Specify one or more of the following keywords:
ALL produces all the statistics.
WCOUNT weighted count of non-missing values
MAX maximum value
MIN minimum value
MEAN mean value
STDV standard deviation
SKEW skewness
KURT kurtosis
VAR variance
STDE standard error of the mean
CV coefficient of variability
CI 95% confidence interval about the mean
SUM sum
MODE mode value
MED median value
Q25 first quartile
Q50 second quartile (same as MED)
Q75 third quartile
If the STATISTICS clause is not specified, statistics are not produced.

TITLE Specifies the text on the FREQUENCIES report subtitle line. Enclose the text in quotes. If TITLE is not used, the subtitle line is left blank.

HISTOGRAM Specifies that a histogram is printed in addition to the frequency table. A histogram is a bar chart that displays a frequency distribution the values of a variable.

WEIGHT Specifies the procedure variable used as a weighting factor for the variables in FREQUENCIES. Normally, cell counts are incremented by one for each appropriate occurrence. When a weighting value is specified, the cell count is incremented by the value in the specified variable.

ORDER Specifies that the frequency table is printed in increasing order of frequency count (the smallest frequency first), rather than in increasing order of category value that is the default.

NOLABELS Specifies that variable labels are not printed. By default, the FREQUENCIES report lists both the variable name and label. Value labels, if they exist, are printed.

BOOLEAN Specifies which procedure table records are used by the procedure. The procedure table records for which the logical expression is true are used by the procedure. If this option is not specified, all procedure table records are used.

SAMPLE Specifies that a random sample of the procedure table records are used by the procedure.
The fraction specifies the percent of records used and is specified as a positive decimal number less than or equal to 1 (one). .25, for example specifies that a 25% sample be used.
See
examples.

homecontents start chapter top of pagebottom of pagenext page index

Examples

Example 1: Integer Mode with Statistics and Title

Produces a report on Education Level (EDUC) that includes all statistics:

RETRIEVAL
PROCESS CASES
.  PROCESS REC EMPLOYEE
.    GET VARS EDUC
.    PERFORM PROCS
.  END REC
END CASE
FREQUENCIES INTEGER    = EDUC (1 , 6) /
            FILENAME   = FREQS1.TXT  /
            TITLE      = 'Education Levels in Company' /
            STATISTICS = ALL /
END RETRIEVAL
The file FREQS1.TXT contains the following report upon completion of the program.

Education Levels in Company

EDUC        Education level

VALUE LABEL                 VALUE       ABSOLUTE   RELATIVE  CUMULATIVE
                                       FREQUENCY  FREQUENCY   REL FREQ
                                                  (PERCENT)   (PERCENT)

Elementary                   1.00           3.00      15.00       15.00
High School                  2.00           2.00      10.00       25.00
Some University              3.00           4.00      20.00       45.00
B.Sc. or B.A.                4.00           6.00      30.00       75.00
M.S.                         5.00           3.00      15.00       90.00
Ph.D.                        6.00           2.00      10.00      100.00
                                      ----------    -------     -------
                            TOTAL          20.00     100.00      100.00

STATISTICS.....

WGT CNT             20.000              MAXIMUM              6.000
MINIMUM              1.000              MEAN                 3.500
STD DEV              1.539              SKEWNESS            -0.193
KURTOSIS            -0.690              VARIANCE             2.368
STD ERR              0.344              C.V. PCT            43.971
.95 C.I.             2.780                 TO                4.220
SUM                 70.000              MODE                 4.000
MEDIAN               4.000              QUARTILE-25          2.500
QUARTILE-75          4.500



VALID OBSERVATIONS               20
MISSING OBSERVATIONS              0
REJECTED OBSERVATIONS             0

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Example 2: Continuous Mode with Selected Statistics

The following specifies six equal sized categories within the salary range of 1000 to 4000. Note that the Frequencies output does not list the range from 1000 to 1500 because no values in that range were encountered.

RETRIEVAL
PROCESS CASES
.  PROCESS REC EMPLOYEE
.    GET VARS SALARY
.    PERFORM PROCS
.  END REC
END CASE
FREQUENCIES CONTINUOUS = SALARY (6 , 1000 , 4000) /
            FILENAME   = FREQS2.TXT  /
            STATISTICS = MEAN MEDIAN STDV MIN MAX /
END RETRIEVAL
Output:

SALARY      Current monthly salary

LOWER             UPPER    ABSOLUTE         RELATIVE         CUMULATIVE
LIMIT             LIMIT    FREQUENCY        FREQUENCY        REL  FREQ
                                            (PERCENT)        (PERCENT)

1500.00          2000.00      1.00            5.00             5.00
2000.00          2500.00      6.00           30.00            35.00
2500.00          3000.00      6.00           30.00            65.00
3000.00          3500.00      5.00           25.00            90.00
3500.00          4000.00      2.00           10.00           100.00
                          ----------        -------          -------
                   TOTAL     20.00          100.00           100.00

STATISTICS.....

MAXIMUM           4000.000           MINIMUM       1650.000
MEAN              2780.000           STDDEV         573.631
MEDIAN            2750.000



VALID OBSERVATIONS                20
MISSING OBSERVATIONS               0
REJECTED OBSERVATIONS              0

Example 3: General Mode with No Statistics

Note that the output of this is identical to that of the first example, specified with the INTEGER clause. Given a choice of modes, INTEGER is slightly more efficient than GENERAL.

RETRIEVAL
PROCESS CASES
.  PROCESS REC EMPLOYEE
.    GET VARS EDUC
.    PERFORM PROCS
.  END REC
END CASE
FREQUENCIES GENERAL      = EDUC (6 ) /
            FILENAME     = FREQS3.TXT  /
            TITLE        = 'Education Levels in Company' /
END RETRIEVAL
Output:

Education Levels in Company

EDUC     Education level

VALUE LABEL       VALUE      ABSOLUTE   RELATIVE  CUMULATIVE
                             FREQUENCY  FREQUENCY   REL FREQ
                             (PERCENT)  (PERCENT)

Elementary         1.00        3.00       15.00       15.00
High School        2.00        2.00       10.00       25.00
Some University    3.00        4.00       20.00       45.00
B.Sc. or B.A.      4.00        6.00       30.00       75.00
M.S.               5.00        3.00       15.00       90.00
Ph.D.              6.00        2.00       10.00      100.00
                           ----------    -------    -------
                  TOTAL       20.00      100.00      100.00

STATISTICS.....



VALID OBSERVATIONS      20
MISSING OBSERVATIONS     0
REJECTED OBSERVATIONS    0

Example 4: Interval Mode for Unequal Sized Categories

RETRIEVAL
PROCESS CASES
.  PROCESS REC EMPLOYEE
.    GET VARS SALARY
.    PERFORM PROCS
.  END REC
END CASE
FREQUENCIES INTERVALS  =SALARY (1000,2000,3000,3500,4000) /
         FILENAME   = FREQS4.TXT  /
END RETRIEVAL
Output:

SALARY     Current monthly salary

LOWER     UPPER      ABSOLUTE      RELATIVE         CUMULATIVE
LIMIT     LIMIT     FREQUENCY      FREQUENCY        RELFREQ
                                   (PERCENT)        (PERCENT)

1000.00  2000.00        1.00         5.00              5.00
2000.00  3000.00       12.00        60.00             65.00
3000.00  3500.00        5.00        25.00             90.00
3500.00  4000.00        2.00        10.00            100.00
                    ----------     -------           -------
         TOTAL         20.00       100.00            100.00
STATISTICS....

VALID OBSERVATIONS               20
MISSING OBSERVATIONS              0
REJECTED OBSERVATIONS             0

Example 5: A Histogram

RETRIEVAL
PROCESS CASES
.  PROCESS REC EMPLOYEE
.  GET VARS EDUC
.  PERFORM PROCS
.  END REC
END CASE
FREQUENCIES INTEGER      = EDUC(1 , 6) /
            FILENAME     = FREQS5.TXT  /
            HISTOGRAM /
END RETRIEVAL
Output:

EDUC     Education level

VALUE LABEL       VALUE      ABSOLUTE    RELATIVE      CUMULATIVE
                             FREQUENCY   FREQUENCY      REL FREQ
                             (PERCENT)   (PERCENT)

Elementary         1.00        3.00       15.00           15.00
High School        2.00        2.00       10.00           25.00
Some University    3.00        4.00       20.00           45.00
B.Sc. or B.A.      4.00        6.00       30.00           75.00
M.S.               5.00        3.00       15.00           90.00
Ph.D.              6.00        2.00       10.00          100.00
                          ----------     -------         -------
                     TOTAL    20.00      100.00          100.00

EDUC     Education level

VALUE
            I
       1.00 *******************************
            I Elementary
            I (3.00)  15.00PCT
            I
       2.00 *********************
            I High School
            I (2.00)10.00 PCT
            I
       3.00 *****************************************
            I Some University
            I (4.00)  20.00 PCT
            I
       4.00 *******************************************************
            I B.Sc. or B.A.
            I (6.00)  30.00 PCT
            I
       5.00 *******************************
            I M.S.
            I (3.00)  15.00 PCT
            I
       6.00 *********************
            I Ph.D.
            I (2.00)  10.00PCT
            I
            I
            I....I....I....I....I....I....I....I....I....I....I
FREQUENCY   0   .5  1.0  1.5  2.0  2.5  3.0  3.5  4.0  4.5  5.0

STATISTICS.....




VALID OBSERVATIONS        20
MISSING OBSERVATIONS       0
REJECTED OBSERVATIONS    0

homecontents start chapter top of pagebottom of pagenext page index