SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 1 Vol 2

CROSS TABULATE

Name:
    CROSS TABULATE
Type:
    Analysis Command
Purpose:
    Generates a cross tabulation of a response variable for between two and six independent variables.
Description:
    The independent variables (also referred to as group-id variables), are mutually exclusive categories which form a two-way table. The response variable must fall into exactly one row and column of this table. By default, this command calculates the counts for each row and column combination. Alternatively, it can calculate a specified statistic for each row and column combination.

    The 3/2008 version extended support for up to six independent variables.

    The 5/2014 version extended support for up to eight independent variables.

Syntax 1:
    CROSS TABULATE <tag1> ... <tagk>
                            <SUBSET/EXCEPT/FOR qualification>
    CROSS TABULATE COUNTS <tag1> ... <tagk>
                            <SUBSET/EXCEPT/FOR qualification>
    where <tag1> ... <tagk> is a list of one to eight group-id variables;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.

    This syntax generates a count of the number of elements in each row and column combination.

Syntax 2:
    CROSS TABULATE <STAT> <y1> ... <yl> <tag1> ... <tagk>
                            <SUBSET/EXCEPT/FOR qualification>
    where <y1> ... <yl> is a list of one to three response variables (depending on <stat>;
                <tag1> ... <tagk> is a list of one to eight group-id variables;
                <stat> is one of Dataplot's supported statistics;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.

    This syntax computes the value of the specified statistic of the elements in the response variables (<y1> ... <yl>) for each row and column combination.

    For a list of supported statistics, enter

    Note that if the statistic is SIZE (or NUMBER), then the response variable is omitted.

Examples:
    CROSS TABULATE TAG1 TAG2
    CROSS TABULATE MEAN Y1 TAG1 TAG2
    CROSS TABULATE SD Y1 TAG1 TAG2 SUBSET TAG2 = 2 TO 4
Note:
    The output is also written to the file DPST1F.DAT. For example,

      CROSS TABULATE MEAN Y X1 X2
      SKIP 1
      READ Z1 Z2 ZMEAN
Note:
    To specify the number of digits to print to the right of the decimal point, enter the command (the default is exponential format)

      SET WRITE DECIMALS <value>
Note:
    Since there is now a separate CHI-SQUARE INDEPENDENCE TEST, the CHI-SQUARE option available in prior versions of Dataplot is no longer supported.
Note:
    If <stat> is BINOMIAL PROPORTION or DIFFERENCE OF BINOMIAL PROPORTIONS, then a few extra columns are printed.

    In these cases, the response variable is assumed to consist of 1's or 0's (to denote success or failure, respectively). In addition to the proportion of successes, a column will be printed for the number of trials and for the lower and upper Agresti-Coull confidence limits. To specify whether lower tailed, upper tailed, or two-tailed confidence limits are desired, enter the command (two-tailed is the default)

      SET BINOMIAL TAIL <LOWER/UPPER/TWO-TAILED>

    To specify the significance level to use for the confidence limits, enter (0.05 is the default)

      LET ALPHA = <value>
Note:
    In generating the cross tabulation, a cell may be empty. The following command specifies what to do when an empty cell is encountered.

      SET CROSS TABULATE MISSING <SKIP/ZERO/MV>

    If SKIP is entered (this is the default), the empty cell is omitted from the output.

    If ZERO is entered, the value for the empty cell is set to zero.

    If MV is entered, the value for the empty cell is set to a missing value code. The value for the missing value code is specified with the command

      SET CROSS TABULATE MISSING VALUE <value>

    where <value> is a numeric value. The default value is -9999.

Default:
    None
Synonyms:
    TABULATE is a synonym for CROSS TABULATE
Related Commands: Applications:
    Exploratory Data Analysis, Categorical Data Analysis
Implementation Date:
    1989/12
    2002/8: List of supported statistics greatly expanded.
    2003/3: Support for "WEIGHTED" and "DIFFERENCE OF" statistics added.
    2003/5: Added support for SN SCALE, QN SCALE, DIFFERENCE OF SN, DIFFERENCE OF QN
    2008/3: Added support for more than 2 group-id variables
    2008/3: Added support for SET WRITE DECIMALS command
    2010/2: TABULATE and CROSS TABULATE commands merged
    2014/5: Increase number of factor variables from six to eight
Program:
     
    SKIP 25
    READ RIPKEN.DAT Y X1 X2
    CROSS TABULATE X1 X2
    CROSS TABULATE MEAN Y X1 X2
    CROSS TABULATE SD Y X1 X2
    CROSS TABULATE RANGE Y X1 X2
        
    The following output is generated.
     
                Cross Tabulate NUMBER
     
    ------------------------------------------------------------
           X1             X2         |            NUMBER
    ------------------------------------------------------------
             1.0000         1.0000   |            4.0000
             1.0000         2.0000   |            4.0000
             1.0000         3.0000   |            4.0000
             2.0000         1.0000   |            4.0000
             2.0000         2.0000   |            4.0000
             2.0000         3.0000   |            4.0000
             3.0000         1.0000   |            4.0000
             3.0000         2.0000   |            4.0000
             3.0000         3.0000   |            4.0000
     
     
                Cross Tabulate MEAN
     
    (Response Variables: Y        )
    ------------------------------------------------------------
           X1             X2         |              MEAN
    ------------------------------------------------------------
             1.0000         1.0000   |            0.2785
             1.0000         2.0000   |            0.3558
             1.0000         3.0000   |            0.2360
             2.0000         1.0000   |            0.3283
             2.0000         2.0000   |            0.5220
             2.0000         3.0000   |            0.4950
             3.0000         1.0000   |            0.1375
             3.0000         2.0000   |            0.2258
             3.0000         3.0000   |            0.2138
     
     
                Cross Tabulate STANDARD DEVIATION
     
    (Response Variables: Y        )
    ------------------------------------------------------------
           X1             X2         |   STANDARD DEVIAT
    ------------------------------------------------------------
             1.0000         1.0000   |            0.1301
             1.0000         2.0000   |            0.0170
             1.0000         3.0000   |            0.1716
             2.0000         1.0000   |            0.0378
             2.0000         2.0000   |            0.2392
             2.0000         3.0000   |            0.3398
             3.0000         1.0000   |            0.0368
             3.0000         2.0000   |            0.1014
             3.0000         3.0000   |            0.1506
     
          GROUP-IDs AND STATISTIC WRITTEN TO FILE DPST1F.DAT
     
     
                Cross Tabulate RANGE
     
    (Response Variables: Y        )
    ------------------------------------------------------------
           X1             X2         |             RANGE
    ------------------------------------------------------------
             1.0000         1.0000   |            0.2340
             1.0000         2.0000   |            0.0400
             1.0000         3.0000   |            0.3880
             2.0000         1.0000   |            0.0800
             2.0000         2.0000   |            0.5250
             2.0000         3.0000   |            0.7150
             3.0000         1.0000   |            0.0800
             3.0000         2.0000   |            0.2320
             3.0000         3.0000   |            0.3330
        
Date created: 01/23/2009
Last updated: 12/11/2023

Please email comments on this WWW page to alan.heckert@nist.gov.