TABLECELLS Subcommand (OUTPUT MODIFY Command)

The TABLECELLS subcommand specifies areas of tables to change and conditions under which to make those changes.

SELECT keyword

The SELECT keyword specifies the area of the table. The keyword is followed by an equals sign and a list of keywords or quoted strings, which are enclosed in square brackets.

The following keywords apply to general areas of the table:

BODY
The data cells of the tables. The body of the table does not include row and column labels.
HEADERS
All row and column labels. This option includes all labels for nested rows and columns.
FOOTNOTES
All footnote text.
TITLE
The title that is displayed above the table.
CAPTION
All caption text.

The following keywords apply to specific conditions:

COUNT
Rows or columns with any of these labels or the equivalent in the current output language: "Frequency", "Count", "N".
MEAN
Rows or columns with the label "Mean" or the equivalent in the current output language.
MEDIAN
Rows or columns with the label "Median" or the equivalent in the current output language.
RESIDUAL
Rows or columns with any of these labels or the equivalent in the current output language: "Resid", "Residual", "Std. Residual".
PERCENT
Rows or columns with the label "Percent" or the equivalent in the current output language.
SIGNIFICANCE
Rows or columns with any of these labels or the equivalents in the current output language: "Approx Sig.", "Asymp. Sig (2-sided)", "Exact Sig.", "Exact Sig. (1-sided)", "Exact Sig. (2-sided)", "Sig.", "Sig. (1-tailed)", "Sig. (2-tailed)"
VALID
Rows or columns with the label "Valid" or the equivalent in the current output language.
TOTAL
Rows or columns with the label "Total" or the equivalent in the current output language.
MISSING
Rows or columns with the label "Missing" or the equivalent in the current output language.
CUMULATIVEPERCENT
Rows or columns with the label "Cumulative Percent" or the equivalent in the current output language.
VALIDPERCENT
Rows or columns with the label "Valid Percent" or the equivalent in the current output language.
CORRELATION
Rows or columns with any of these labels or the equivalent in the current output language: "Correlation Coefficient", "Correlations", "Pearson Correlation".
POSITION(integer)
Data row or column position. (The SELECTDIMENSION keyword specifies either rows of columns.) This does not include row label columns or column label rows.
"expression"
A quoted string that represents the value of a row or column label.

SELECTDIMENSION keyword

The SELECTDIMENSION keyword specifies whether SELECT applies to columns or rows or both.

  • The keyword is followed by an equals sign and the keyword COLUMNS, ROWS, or BOTH. The default option is BOTH.
  • The keyword is ignored for SELECT conditions BODY, HEADERS, FOOTERNOTES, TITLE, and CAPTION.

SELECTCONDITION keyword

The SELECTCONDITION keyword specifies the conditions under which to apply the changes within the area of the table specified by SELECT and SELECTDIMENSION. The keyword is followed by an equals sign and a list of keywords or quoted strings, which are enclosed in square brackets.

ALL
All conditions. This option is the default. If ALL is specified with any other conditions, the other conditions are ignored.
TOP(integer)
The n highest values in the specified area.
BOTTOM(integer)
The n lowest values in the specified area.
PARENT(expression)
The primary expression value in the specified area. The value can be a quoted string, MISSING, or VALID.
CHILD(expression)
The secondary expression value in the specified area. The value can be a quoted string, MISSING, or VALID.
"expression"
A quoted string that contains a comparison expression.
  • The expression can include standard comparison operators (<, <=, >, >=, <>) and the keyword ABS for absolute value, followed by an expression in parentheses.
  • The keyword SYSMIS indicates the system-missing value (for numeric values only).
  • A lower case "x" is used as a stand-in variable to represent all values in the area of the table specified by the SELECT and SELECTDIMENSION keywords. For example: "x<=.05".
  • If the expression contains string values, those values must be quoted.

COLUMNWIDTH keyword

The COLUMNWIDTH keyword specifies the width of the column or columns in the specified area of the table. The keyword is followed by an equals sign and the keyword CENTIMETERS, INCHES, or POINTS, followed by a positive number that is enclosed in parentheses.

APPLYTO keyword

The APPLYTO Keyword specifies what areas of the table to change based on the selection criteria.

  • APPLYTO can apply changes to elements of the table that are not included in the selection criteria. For example, if the selection criteria specifies specific values in a specific column, APPLYTO=ROW applies the changes to entire rows that contain the column values that meet the selection criteria.
  • APPLYTO is ignored for BODY, HEADERS, FOOTNOTE, TITLE, and CAPTION.
CELL
Applies changes only to data cells that meet the selection criteria.
COLUMN
Applies changes to entire columns that contain data values or an innermost column label that meet the selection criteria.
ROW
Applies changes to entire rows that contain data values or an innermost row label that meet the selection criteria.
COLUMNDATA
Applies changes to all data cells in the columns that contain data values that meet the selection criteria.
ROWDATA
Applies changes to all data cells in the rows that contain data values that meet the selection criteria.
COLUMNHEADER
Applies changes to the innermost column labels that meet the selection criteria.
ROWHEADER
Applies changes to the innermost row labels that meet the selection criteria.

REVERTTODEFAULT keyword

The REVERTTODEFAULT keyword removes any special formats or styles that have been applied to a table and reverts to the original Tablelook style.

  • The keyword is followed by an equals sign and the keyword YES or NO. The default option is NO.
  • When this keyword is used with other TABLECELLS format or style changes, REVERTTODEFAULT will undo any changes that are specified after it. Specify REVERTODEFAULT first if you want to make other changes after reverting to the default TableLook.

FORMAT keyword

The FORMAT keyword specifies the format for data values. The keyword is followed by an equals sign and a valid format specification, such as F10.4, PCT5.1, or A20. For detailed information about available formats and specifications, see Variable Types and Formats

FONT keyword

The FONT keyword specifies the font to use.
  • The keyword is followed by an equals sign and the name of a font that is enclosed in quotation marks.
  • If the specified font is not available, this setting is ignored.

FONTSIZE keyword

The FONTSIZE keyword specifies the font size (in points). The keyword is followed by an equals sign and a positive number.

STYLE keyword

The STYLE keyword specifies the font style.

  • The keyword is followed by an equals sign and a list of styles.
  • Valid style values are REGULAR, BOLD, ITALIC, and UNDERLINE.
  • Style specifications are cumulative. If the text is already italic, the BOLD keyword makes the text italic and bold.
  • The REGULAR keyword removes any special style characteristics. When used with other style keywords, it must be specified first; otherwise any previous style specifications are removed. For example, STYLE=REGULAR BOLD results in bold text without any other special style characteristics, but STYLE=BOLD REGULAR results in text that is not bold.

TEXTCOLOR and BACKGROUNDCOLOR keywords

The TEXTCOLOR keyword specifies the text color. The BACKGROUNDCOLOR keyword specifies the background color.

  • The keyword is followed by an equals sign and a color keyword or RGB(r, g, b), where r, g, and b are numeric red, green, and blue color values. The numeric values are integers between 1 and 255.
  • Valid color keywords are BLACK, BLUE, CYAN, DARKGRAY, GRAY, GREEN, LIGHTGRAY, MAGENTA, ORANGE, PINK, RED, WHITE, YELLOW.

REPLACE keyword

The REPLACE keyword replaces any text that meets the selection criteria with the specified number or quoted string value.

HIDE keyword

When set to YES, the HIDE keyword suppresses the selected row or column. The keyword allows table output to adhere to APA style guidelines.

UNGROUP keyword

When set to YES, the UNGROUP keyword deletes the selected row or column group header. The keyword allows table output to adhere to APA style guidelines.

Example

OUTPUT MODIFY
  /SELECT TABLES /IF SUBTYPES =['Frequencies']
  /TABLECELLS  SELECT=["Percent"] 
   SELECTDIMENSION=COLUMNS SELECTCONDITION=["x>=30"]
   APPLYTO=CELL STYLE=REGULAR BOLD
  /SELECT TABLES /IF SUBTYPES=['Frequencies']
  /TABLECELLS SELECT=["Cumulative Percent"]
   SELECTDIMENSION=COLUMNS SELECTCONDITION=["x>=50"]
   APPLYTO=ROW BACKGROUNDCOLOR=GREEN
  /SELECT TABLES /IF SUBTYPES=["Frequencies"]
  /TABLECELLS SELECT=["Total"]
   SELECTDIMENSION=ROWS APPLYTO=ROW 
   REVERTTODEFAULT=YES.
Figure 1. Table modified by TABLECELLS subcommands
Table that is modified by TABLECELLS subcommands
  • The TABLESCELLS subcommand in the first SELECT block finds values greater than or equal to 30 in the column labeled "Percent" and makes them bold.
  • The TABLECELLS subcommand in the second SELECT block finds values greater than or equal to 50 in the column labeled "Cumulative Percent" and makes the background color of those rows green.
  • Since the first two TABLECELLS subcommands also change the total row at the bottom of the table, the last TABLECELLS subcommand uses REVERTTODEFAULT to remove any special formatting that was applied to the total row.