/smrput

Repository for smrput (AKA "smart put" Stata packages). Intended for use with putdocx, putpdf, and related.

Primary LanguageStataMIT LicenseMIT

1. Smart Put

Repository for smrput (AKA "smart put" Stata packages) for use with putdocx. A family of commands that produces various tables through putdocx.

Version 2.0 available as of April 20th, 2018 from Boston College Statistical Software Components (SSC) :

ssc install smrtbl

Production Version available from this repo :

net install smrtbl, from(https://raw.githubusercontent.com/adamrossnelson/smrput/master/)

Version 2.0 is "ifable" and "inable"

1.1. Table of Contents

1.2. Introduction

A conversation on statalist.org inspired this package:

https://www.statalist.org/for...post1416542 and

https://www.statalist.org/for...stata-result-to-word-file.

1.3. Table of commands

Command Name Description
smrtbl produces one- or two-way tables.
smrcol produces a table of dummy varaibles and related summary statistics.
smrfmn produces a table of summary statistics filtered by one or more indicator variables.

2. Installation

2.1. Boston College Statistical Software Components (SSC)

ssc install smrtbl

2.2. From GitHub.com

Installing from GitHub.com will install the most recent development version.

net install smrtbl, from(https://raw.githubusercontent.com/adamrossnelson/smrput/master/)

Upon installation command help and documenation available by help smrtbl, help smrcol, and/or help smrfmn.

3. Example

The following is a self-contained example using smrtble.

clear all
sysuse auto

capture putdocx clear

    // Begin a new word document.
putdocx begin

    // Provide introductory text.
putdocx paragraph, style(Title)
putdocx text ("Here is a demonstration of -smrtble-")
putdocx paragraph, style(Subtitle)
putdocx text ("More information at: https://github.com/adamrossnelson/smrput")

putdocx paragraph, style(Heading1)
putdocx text ("One-way examples")

    // Talk about the table to be presented.
putdocx paragraph
putdocx text ("Here is some text for demonstration purposes. Followed by a table:")
    // Call smrtbl with one variable name for a one-way table.
    // smrtbl must be called in the context of an open putdocx word document.
smrtbl foreign

putdocx paragraph
putdocx text ("For good measure, second example: two tables from a different data set:")
sysuse bplong.dta, clear
    // Call smrtbl with one variable name for a one-way table.
smrtbl when
smrtbl sex

    // Manage page spacing.
putdocx paragraph
putdocx text ("Be sure to see second page for more . . . ")
putdocx pagebreak

putdocx paragraph, style(Heading1)
putdocx text ("Two-way examples")
putdocx paragraph
putdocx text ("One example of a two-way table:")
    // Call smrtbl with one variable name for a two-way table.
smrtbl agegrp sex

    // Save word docx file.
putdocx save "GitHub.docx", replace

4. Dev Log, Known limitations

Version 1.0.0 did/does does not support if or in options.
Version 2.0.0 now supports if and in options.

5. See Also

PUTDOCXFREQTABLE: Stata module to produce frequency oneway tables with putdocx.
https://ideas.repec.org/c/boc/bocode/s458464.html