Title

tlist -- Comprehensive tabular output

Syntax

tlist [varelist] [| varelist ...] [if] [in] [, options]

general options

stub(integer) the number of left-hand columns to use as row headings

foot(stat list) A list of summary statistics and labels to go at the end of the table

distinct[(varelist)] display only rows with distinct values

random[(integer)] random subset to display

skipnames Don't use variable info in header

style options

altback(integer) alternate row backrounds

vline(details) vertical lines

hline(details) horizontal lines

align(details) text alignment

wrap(details) text wrapping

class(details) other style info

Description

tlist can profitably be used as a replacement for list, but given the extensive style options and html output, it can also be used as a general-purpose table-composer.

When a single varelist is specified, the column headings will be the variable names and/or labels.
When multiple varelists are specified (that is, separated by |), each set will have one or more super-headings as specified with, and described under, tlisthead.

General Options

stub(integer) specifies the number of left-hand columns to be treated as the stub (ie, row headings). It defaults to 0.

foot(C-func list) specifies summary statistics for the last rows of the table.

If stub() is specified, the left-most columns will display a description for each C-func.
This description can be specified in the C-func description() option.

[+] Since the C-funcs implicitly refer to the main varelist, they are in vars-by-funcs context, and should be specified as, eg, Mean().

distinct[(varelist)] displays only one row with each distinct combination of varelist - which row, exactly, is indeterminate.
If varelist is not specified, the main varelist is used.

random[(integer)] restricts the display to integer randomly selected rows. The random selection happens after exclusions for [if] [in] and distinct().
When random is specified without a parameter, one screen-full is displayed.

skipnames causes the display to omit the variable names/labels from the column headers; using only the super-headers specified in tlisthead.
When this option is specified, nlabels() has no effect.

nl1 governs the main (body) column-headings, and nl2 governs the stub column-headings.

vl1 governs the body of the table, and vl2 governs the stub.

Style Options

altback(integer) specifies the number of consecutive rows to be styled normally/alternately. If altback() is not specified, it defaults to one.

The effect varies depending on the out() option: For html output, alternate row backgrounds are slightly shaded.
For stata or email output, when altback() is greater than 1, alternate rows are italicized.

Also, see below for use of class(altback:); when that is specified, the altback() option has no effect.

vline(), hline(), align(), wrap(), and class() may each be specified multiple times per command, to style multiple areas.
In the case of vline() or hline(), the defined lines are to the right or below the specified cells, respectively.

The body of each option is:

style-name:styled-area

where style-name is mainly an option-specific word:

option style-names

vline() major, minor, space, or none

hline() major, minor, space, or none

align() left, right, or center

wrap() integer

class() The available class() names are determined by the out() option:

Destination Class Names

results elfs outstata

viewer elfs outstata

html page elfs outhtml

html file elfs outhtml

html file, email elfs outemail

mata any, depending

There will always be a selected scheme (set of standard classes), but you can also define classes on-the-fly in the out() option.
Class names defined in the out() option can be applied to the data via class().

and where styled-area is:

[varelist] [if] [in] [,rows(numlist)]

o- varelist determines the columns to style (ie, the variables).

o- rows(numlist) selects rows of the display to style.

rows(3(2)20) would style every other row from 3 to 20, including the header.

o- [if] [in] selects rows from the dataset to style. The conditions can include variables and rows that are not displayed. Eg:

tlist a b c, class(hi1:if x>5)

displays variables a, b, and c, highlighting rows for which variable x (not displayed) is greater than 5.

Note for wrap():

o- The specified integer is the character count of the first line indent. Negative numbers specify a hanging indent, and zero specifies text-wrapping with no indent.

o- It has no effect on html output, which always wraps rather than truncating.

Example

tlist a b c, vline(major:a) vline(minor:b) ///
hline(space:if x==5) class(bf:c if p<.05) class(v-thisway:a)

tlist, class(mystyle: var1) out(htm, ///
style(.mystyle red; background:yellow; font-weight:bold))