**[ST] strate** -- Tabulate failure rates and rate ratios

__Syntax__

Tabulate failure rates

**strate** [*varlist*] [*if*] [*in*] [**,** *strate_options*]

Calculate rate ratios with the Mantel-Haenszel method

**stmh** *varname* [*varlist*] [*if*] [*in*] [**,** *options*]

Calculate rate ratios with the Mantel-Cox method

**stmc** *varname* [*varlist*] [*if*] [*in*] [**,** *options*]

*strate_options* Description
-------------------------------------------------------------------------
Main
**per(***#***)** units to be used in reported rates
**smr(***varname***)** use *varname* as reference-rate variable to
calculate SMRs
__cl__**uster(***varname***)** cluster variable to be used by the
jackknife
__j__**ackknife** report jackknife confidence intervals
__m__**issing** include missing values as extra categories
__l__**evel(***#***)** set confidence level; default is **level(95)**
__out__**put(***filename*[**,replace**]**)** save summary dataset as *filename*; use
**replace** to overwrite existing *filename*
__noli__**st** suppress listed output
__g__**raph** graph rates against exposure category
__now__**hisker** omit confidence intervals from the graph

Plot
*marker_options* change look of markers (color, size, etc.)
*marker_label_options* add marker labels; change look or position
*cline_options* affect rendition of the plotted points

CI plot
__ciop__**ts(***rspike_options***)** affect rendition of the confidence
intervals (whiskers)

Add plots
**addplot(***plot***)** add other plots to the generated graph

Y axis, X axis, Titles, Legend, Overall
*twoway_options* any options other than **by()** documented in
**[G-3]** *twoway_options*
-------------------------------------------------------------------------

*options* Description
-------------------------------------------------------------------------
Main
**by(***varlist***)** tabulate rate ratio on *varlist*
__c__**ompare(***num1***,***den2***)** compare categories of exposure variable
__m__**issing** include missing values as extra categories
__l__**evel(***#***)** set confidence level; default is **level(95)**
-------------------------------------------------------------------------

You must **stset** your data before using **strate**, **stmh**, and **stmc**; see **[ST]**
**stset**.
**by** is allowed with **stmh** and **stmc**; see **[D] by**.
**fweight**s, **iweight**s, and **pweights** may be specified using **stset**; see **[ST]**
**stset**.

__Menu__

__strate__

**Statistics > Survival analysis > Summary statistics, tests, and**
**tables >** **Tabulate failure rates and rate ratios**

__stmh__

**Statistics > Survival analysis > Summary statistics, tests, and**
**tables >** **Tabulate Mantel-Haenszel rate ratios**

__stmc__

**Statistics > Survival analysis > Summary statistics, tests, and**
**tables >** **Tabulate Mantel-Cox rate ratios**

__Description__

**strate** tabulates rates by one or more categorical variables declared in
*varlist*. You can also save an optional summary dataset, which includes
event counts and rate denominators, for further analysis or display. The
combination of the commands **stsplit** and **strate** implements most of, if not
all, the functions of the special-purpose person-years programs in
widespread use in epidemiology; see **[ST] stsplit**.

**stmh** calculates stratified rate ratios and significance tests by using a
Mantel-Haenszel-type method.

**stmc** calculates rate ratios that are stratified finely by time by using
the Mantel-Cox method. The corresponding significance test (the log-rank
test) is also calculated.

Both **stmh** and **stmc** can estimate the failure-rate ratio for two categories
of the explanatory variable specified by the first argument of *varlist*.
You can define categories to be compared by specifying them with the
**compare()** option. The remaining variables in *varlist* before the comma
are categorical variables, which are to be "controlled for" using
stratification. Strata are defined by cross-classification of these
variables.

You can also use **stmh** and **stmc** to carry out trend tests for a metric
explanatory variable. Here a one-step Newton approximation to the
log-linear Poisson regression coefficient is computed.

__Options for strate__

+------+
----+ Main +-------------------------------------------------------------

**per(***#***)** specifies the units to be used in reported rates. For example, if
the analysis time is in years, specifying **per(1000)** results in rates
per 1,000 person-years.

**smr(***varname***)** specifies a reference-rate variable. **strate** then calculates
SMRs rather than rates. This option will usually follow using
**stsplit** to separate the follow-up records by age bands and possibly
calendar periods.

**cluster(***varname***)** defines a categorical variable that indicates clusters
of data to be used by the jackknife. If the **jackknife** option is
selected and this option is not specified, the cluster variable is
taken as the **id** variable defined in the st data. Specifying
**cluster()** implies **jackknife**.

**jackknife** specifies that jackknife confidence intervals be produced.
This is the default if weights were specified when the dataset was
**stset**.

**missing** specifies that missing values of the explanatory variables be
treated as extra categories. The default is to exclude such
observations.

**level(***#***)** specifies the confidence level, as a percentage, for confidence
intervals. The default is **level(95)** or as set by **set level**.

**output(***filename* [**,replace**]**)** saves a summary dataset in *filename*. The
file contains counts of failures and person-time, rates (or SMRs),
confidence limits, and all the categorical variables in the *varlist*.
This dataset could be used for further calculations or simply as
input to the **table** command.

**replace** specifies that *filename* be overwritten if it exists. This
option is not shown in the dialog box.

**nolist** suppresses the output. This is used only when saving results to a
file specified by **output()**.

**graph** produces a graph of the rate against the numerical code used for
categories of *varname*.

**nowhisker** omits the confidence intervals from the graph.

+------+
----+ Plot +-------------------------------------------------------------

*marker_options* affect the rendition of markers drawn at the plotted
points, including their shape, size, color, and outline; see **[G-3]**
*marker_options*.

*marker_label_options* specify if and how the markers are to be labeled;
see **[G-3]** *marker_label_options*.

*cline_options* affect whether lines connect the plotted points and the
rendition of those lines; see **[G-3]** *cline_options*.

+---------+
----+ CI plot +----------------------------------------------------------

**ciopts(***rspike_options***)** affects the rendition of the confidence intervals
(whiskers); see **[G-3]** *rspike_options*.

+-----------+
----+ Add plots +--------------------------------------------------------

**addplot(***plot***)** provides a way to add other plots to the generated graph;
see **[G-3]** *addplot_option*.

+-----------------------------------------+
----+ Y axis, X axis, Titles, Legend, Overall +--------------------------

*twoway_options* are any of the options documented in **[G-3]** *twoway_options*,
excluding **by()**. These include options for titling the graph (see
**[G-3]** *title_options*) and for saving the graph to disk (see **[G-3]**
*saving_option*).

__Options for stmh and stmc__

+------+
----+ Main +-------------------------------------------------------------

**by(***varlist***)** specifies categorical variables by which the rate ratio is to
be tabulated.

A separate rate ratio is produced for each category or combination of
categories of *varlist*, and a test for unequal rate ratios (effect
modification) is displayed.

**compare(***num1***,***den2***)** specifies the categories of the exposure variable to
be compared. The first code defines the numerator categories, and
the second code defines the denominator categories.

When **compare** is absent and there are only two categories, the larger
is compared with the smaller; when there are more than two
categories, **compare** analyzes log-linear trend.

**missing** specifies that missing values of the explanatory variables be
treated as extra categories. The default is to exclude such
observations.

**level(***#***)** specifies the confidence level, as a percentage, for confidence
intervals. The default is **level(95)** or as set by **set level**.

__Examples of strate__

Setup
**. webuse diet**

Declare data to be survival-time data
**. stset dox, origin(time doe) id(id) scale(365.25)** **fail(fail==1 3 13)**

Split the data into ten-year age bands
**. stsplit ageband, at(40(10)70) after(time=dob) trim**

Tabulate failure rates per 1,000 person-years for categories of **ageband**
**. strate ageband, per(1000)**

Merge reference population dataset with current dataset on **ageband**
**. merge m:1 ageband using http://www.stata-press.com/data/r15/smrchd**

Obtain SMRs and confidence intervals
**. strate ageband, per(1000) smr(rate)**

__Examples of stmh__

Setup
**. webuse diet, clear**

Declare data to be survival-time data
**. stset dox, origin(time dob) enter(time doe) id(id)** **scale(365.25)**
**fail(fail==1 3 13)**

Split the data into ten-year age bands
**. stsplit ageband, at(40(10)70) after(time=dob) trim**

Calculate rate ratio comparing categories of **hienergy**
**. stmh hienergy**

Calculate rate ratio comparing categories of **hienergy** by categories of
**ageband**
**. stmh hienergy, by(ageband)**

Compare the effect of **hienergy** between jobs, controlling for **ageband**
**. stmh hienergy ageband, by(job)**

Test for trend of heart disease rates with **height** controlling for **ageband**
**. stmh height ageband**

__Examples of stmc__

Setup
**. webuse diet, clear**

**stset** the data, specifying **dob** as the origin
**. stset dox, origin(time dob) enter(time doe) id(id)** **scale(365.25)**
**fail(fail==1 3 13)**

Obtain the effect of high energy controlling for age (time) by
stratifying very finely
**. stmc hienergy**

Same as above, but comparing **hienergy** = 0 versus **hienergy** = 1
**. stmc hienergy, c(0,1)**

__Stored results__

**stmh** and **stmc** store the following in **r()**:

Scalars
**r(RR)** overall rate ratio