Title

smrcol -- Produces a table of dummy varaibles and related summary statistics in an active docx using putdocx.

Syntax

smrcol [varlist] [if] [in] [, options]

Where [varlist] is one or more indicator variables.

Main
nocond Suppress output of if and in conditionals. Default behavior is to note each table with if and in conditionals applied.

description Provide a description for output. Default behavior is to provide a generic description.

title Provide a title for output. Default behavior is to provide a generic title.

Description

smrcol produces a table of dummy varaibles and related summary statistics. For each dummy/indicator variable smrcol will generate a table row that places the variable label in column one, the count of missing values in column two, the count that equal zero in column three, the count that equal one in column four, and the percent equaling one in column five.

Provides alternate format for displaying indicator variable summary statistics including indicator variable interaction results.

When an if or in condition is specified smrtbl will report that condition in the putdocx.

Use Case

Useful when reporting categorical counts which are not mutually exclusive. For example, a survey might ask "Indicate what degree(s) have you completed (check all that apply)." The results of this question could not be reported with a simple one-way tabulation because many respondents might have completed multiple degrees.

Example

. use http://www.stata-press.com/data/r15/nlswork.dta

. // Generate indicator variables and interactions.

. tab race, gen(race_ind)

. tab collgrad, gen(col_ind)

. gen white_grad = (race_ind1 == 1 & col_ind2 == 1)

. gen black_grad = (race_ind2 == 1 & col_ind2 == 1)

. gen other_grad = (race_ind3 == 1 & col_ind2 == 1)

. label variable white_grad "race==white & grad == true"

. label variable black_grad "race==black & grad == true"

. label variable other_grad "race==other & grad == true"

. // Start putdocx, enter contextual information.

. capture putdocx clear

. putdocx begin

. putdocx paragraph, style(Title)

. putdocx text ("Demonstration Title")

. putdocx paragraph, style(Subtitle)

. putdocx text ("Demonstration Produced `c(current_date)'")

. putdocx paragraph

. putdocx text ("The following is a tabulation of race and grad status including selected interactions.")

. // Demonstrate smrcol.

. smrcol race_ind1 white_grad race_ind2 black_grad race_ind3 other_grad, desc("Race and graduate indicator descriptives.")

. putdocx save "smrcolDemo.docx"

Author

Adam Ross Nelson

https://github.com/adamrossnelson