1. Trang chủ
  2. » Thể loại khác

tabout user guide hướng dẫn sử dụng tabout

155 28 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Publication Quality Tables in Stata User Guide for tabout Version 3
Tác giả Ian Watson
Thể loại user guide
Năm xuất bản 2016
Định dạng
Số trang 155
Dung lượng 3,14 MB
File đính kèm 104. tabout.rar (3 MB)

Cấu trúc

  • Publication quality tables

    • Introduction

      • Output

      • This guide

      • Installation

    • What makes for good tables

      • Encoding and decoding

      • How tabout implements these principles

      • Reproducible research

      • Dynamic documents

      • Single source publishing

  • Table Content

    • Table content: overview

      • tabout in practice: some short examples

      • Roadmap for Part II

    • Basic tables

      • Twoway tables

      • Twoway tables with statistics

      • Oneway tables

    • Summary tables

      • Twoway summary tables

      • Oneway summary tables

    • Survey tables

      • Basic tables with survey data

      • Summary tables with survey data

    • Reshaping tables

      • Removing unwanted columns or rows

      • Plugging gaps in tables

    • Template Files

      • Introduction

      • Advantages

      • The details

    • Dynamic documents

      • Titles and footnotes

      • Beyond titles and footnotes

      • A legacy system or a brave new world?

      • Dynamic documents

  • Table styles

    • Table styles: overview

      • What you see is not what you get

      • Options and styles

    • Delimited text file tables

      • Text file basics

      • Applications and text files

    • LaTeX tables

      • What is LaTeX

      • Newcomers to LaTeX

      • Automatic compiling of LaTeX documents

      • Enhancements in Version 3

      • Dynamic documents with LaTeX

    • docx tables

      • Introduction: using tabout with Word

      • Genuine Word files

      • Pros and cons

      • Landscape, width and paper size

      • Reproducible research with docx

    • xlsx tables

      • Introduction: genuine Excel files

      • Features of xlsx files

      • Sheets and locations

      • Numeric data?

      • Working with xlsx files in Word

    • html tables

      • The versatility of html

      • Features and differences

        • Cascading style sheets: CSS

      • Dynamic documents with html

  • Details

    • Key details

      • tabout syntax

      • Options: alphabetical listing

      • Options: thematic listing

Nội dung

Output

The output from tabout can be exported directly to typesetting systems

L A TEX home page like L A TEX, to spreadsheets likeExceland to word processors likeWord The

Other applications such as OpenOffice and LibreOffice can open this output, but their ability to create dynamic documents is limited Additionally, the output can be exported as HTML, which is beneficial for sharing documents across various applications, including word processors and eBook readers For examples of the tables produced, refer to Chapter 3.

In 2004, I developed the initial version of tabout for Stata Release 8 By 2006, I revised tabout to create Version 2, which was compatible with Stata Release 9.2, introducing a new and advanced matrix programming language called Mata for data writers.

(with small refinements) circulated for 10 years without any major changes.

During 2016 I rewrotetabout(as Version 3) to make further use ofMata, particularly the new features ofStataRelease 13 which made possible dir- ect export of tables todocxandxlsxfiles (that is, the native file formats

In the article, font conventions are specified: choices in a tabout option are presented in one font, while file formats are indicated in another Version 3 of tabout introduces enhancements such as style output options for docx and xlsx formats, along with new reshaping capabilities that allow users to drop unwanted columns and rows and fill gaps in tables Additional enhancements are highlighted in orange text in the options table at the end of the User Guide, while blue text denotes links throughout the document.

This guide

There are four parts to this guide:

◁ Part I: this introductory chapter and a second chapter discussing the principles of good tables and sound research methods.

Part II of the guide focuses on effectively utilizing tables in Stata, covering essential elements such as headings, titles, footnotes, sample counts, and statistics It also addresses layout adjustments and the rearrangement of tables, along with the introduction of template files, a significant feature in Version 3 that streamlines usage for beginners Additionally, this section demonstrates how to generate dynamic documents, enabling the automatic creation of short reports or web pages directly from Stata.

In this guide, I mention Word and Excel for clarity, not as an endorsement, as I personally use L A TEX These terms have become generic and are familiar to many Stata users, who likely utilize one or both applications.

I make mention below of other applications which are substitutes.

Part III focuses on customizing the appearance of tables, including the selection of fonts, borders, and lines It also addresses various output formats, ensuring compatibility with LaTeX, Word, Excel, and HTML.

◁ Part IV: thekey detailsof usingtaboutin a useful reference format.

All of these details are presented alphabetically and thematically.

This User Guide features multiple cross-links, including connections from the text to the reference table and reciprocal links within the reference table that direct users to relevant tables and code in the main sections of the guide.

For those who prefer not to read the entire User Guide due to its length, you can focus on the example files and the specific section related to your desired output style However, it is highly advisable to review the overview chapters, particularly the "Table Content: Overview."

Table styles: overview They contain some core information which you may miss if you just dip into various parts of theUser Guide.

This guide features various links, primarily in blue, along with additional colored links located above the example code table, directing you to Statado files on the tabout website.

For beginners in Stata, the /// symbols in the example code signify that the command continues on the next line These symbols are applicable to various output styles supported by Stata, and while they resemble the example code in this User Guide, they are tailored to meet specific requirements.

You can also download these example files as a singleStatado file from the following links:

◁ txtwhich is for tab delimited output (and can be used for opening in

WordandExcelusingxlsanddocextensions More on this later).

◁ texwhich is for L A TEX output;

◁ htmwhich is forhtmorhtmloutput, that is, web page output.

I use htm and html interchangeably throughout this

In this guide, I utilize "tex" to refer to the output style, while "L A TEX" is used for all other contexts This distinction helps clarify the different applications of these terms.

If you're uncertain about the differences between file formats like XLS and XLSX or DOC and DOCX, refer to Chapter 10 for an overview of table styles Additionally, consider the significant benefits of using HTML output for your Word documents, which will be explored further in this User Guide.

For security reasons, all downloadable files are given a txt extension, although they are primarily do files You can view these files in your browser to inspect their contents, allowing you to easily copy and paste them into a do file Alternatively, you can save the files to your computer and rename them with the correct do extension to run them in Stata.

Several example files utilize built-in Stata data sets, with two requiring specific initial setup code You can access these setup do files through the links provided below.

This guide features =⇒ symbols that link to an alphabetical listing of specific options mentioned in the text, displayed in a greenish typewriter font Depending on your PDF viewer, hovering over these links may provide a preview of the options Clicking the links will navigate you directly to the option, and most PDF viewers include a back button for easy return to your previous location.

The typeface in this Guidefollows some common programming con- ventions:

◁ teletype text(in whatever colour) is used for words you can type, such as commands;

◁ when the words are coloured this shade of green they are a taboutoption;

◁ when the words are also slanted, they refer to the actual argu- ments inside the options.

The upcoming chapter delves into the philosophical concepts that underpin the design of tabout, making it essential for those interested in creating high-quality tables If you're pressed for time, you may want to revisit this section later; however, for those eager to enhance their table-making skills and optimize their workflow for reproducible research, reading this chapter now is highly recommended.

Installation

Once the new version of tabout is officially released, it can be accessed from the SSC archives by using the command "ssc install tabout, replace" within Stata Currently, executing this command will install Version 2 of tabout.

To install the Version 3 beta, download it from the tabout home page and manually copy the file into an appropriate directory You can place it either directly in your working directory or in a designated folder.

To locate the directories for tabout Version 2 and Version 3 in Stata, use the command `adopath` Typically, Version 2 is found in the `/ado/plus/` directory, while Version 3 is located in the `/ado/personal/` directory Since the personal directory takes precedence in Stata's adopath, Version 3 will run before Version 2 if both are installed.

If you are unsure which version of tabout is the one being used by

To use the tabout command in Stata, type "which tabout" in the command line It's important to note the version number, as it changes with each beta update Be sure to regularly check the tabout homepage to ensure you have the most current version installed.

In an ideal scenario, there would be a single, universal ado file for Stata Version 3 However, the reality is that there are three different versions available on the tabout website, and the appropriate one to download depends on the specific version of Stata you are using.

For users running Stata 14.2 or later, the main version of tabout is recommended To confirm you have the correct version, type "which tabout" in Stata; the output should indicate "*! Stata 14.2 (or later) version" on the second line This version grants access to all features of the docx and xlsx styles.

◁ If you are runningStata 13.1, theB versionoftaboutis for you If you have downloaded the correct version oftabout, when you type which tabout insideStatayou should see on the second line: *!

Stata 13.1 includes the tabout command, which supports both docx and xlsx formats; however, not all features, such as fonts and borders, are fully available This limitation arises because Stata introduced enhanced functionalities for Mata functions in this version.

◁ If you are running versions ofStata earlier than 13 (but later than

9), then theC versionoftaboutis for you If you have downloaded the correct version oftabout, when you typewhich taboutinside

If you are using Stata versions prior to Stata 13, please note that the tabout command does not support docx and xlsx styles However, you can still generate high-quality Word documents by utilizing the htm style For a comprehensive understanding of this approach, refer to the extensive discussion available in the User Guide.

To ensure optimal performance, always update to the latest version of Stata by using the "update all" command If you encounter error messages related to 'undefined' functions, it typically means you are using an incompatible version of tabout for your Stata version.

You issue the tabout command just like any otherStata command The syntax is shown in the syntaxsectionof Chapter16.

What makes for good tables 8 1 Encoding and decoding

How tabout implements these principles

The main way in which tabout implements these principles of graphical excellence is through the use ofpanels While simple two-way tables are

2 What makes for good tables 9 possible,taboutencourages users to build complex tables in which a series of two-way tables are assembled into a single vertical table.

Household comparisons Adult low paid Other All households

How easily raise $2000 in one week

Have to do something drastic 194 16.2 399 10.5 593 11.9

Raise it, but some sacrifices 321 26.8 949 25.1 1,270 25.5

The article explores self-perceptions of financial prosperity within households, highlighting how optimists and pessimists emerge from differing evaluations by household members It notes that counts are lower due to missing observations Additionally, it examines episodes of financial hardship experienced since the beginning of the year, such as late utility or rent payments, pawning or selling possessions, going without meals, lack of home heating, and seeking financial assistance from family, friends, or welfare organizations The worst financial situation reported by at least one household member is also documented Furthermore, the article distinguishes between households with and without credit cards, indicating that those without have no members with credit or charge cards or store accounts, while at least one member in other households does The analysis is weighted by cross-sectional household population weights, and it defines low pay as earning at or below $15.94 per hour.

The population data from Wave 5 (2005) categorizes households into three groups: "Adult," which includes households with at least one low-paid adult employee; "Other," comprising households with at least one employed individual, excluding those classified as "Adult"; and "All," representing households with at least one employed person.

Source: HILDA Release 5 †Responding person survey form; ‡Responding person self-completion survey form; §Household survey form.

Figure 2.1.: Reduced view of a typical full-page tabout table, showing multiple panels.

The preference for a vertical layout in printed materials, particularly books, aligns with the natural reading psychology, as it encourages the eye to move down the page within a narrow visual band Presenting data side by side facilitates easy comparisons of percentages, while including sample sizes enhances the understanding of data precision Additionally, footnotes provide valuable information regarding data sources, population details, and relevant definitions, enriching the reader's comprehension.

Reproducible research

The aesthetic elements of table production enhance communication clarity, but the foundation of accuracy and efficiency is rooted in reproducible research Effective research should provide a clear trail, enabling you or your peers to trace the methodology behind your results even a year later Researchers should embrace the mantra "copy and paste is my enemy" and implement practices that ensure "files talking to files," which is essential for reproducibility.

Stata’s own emphasis ondofiles, and the idea of building a nesteddofile system, where onedofile calls otherdofiles For example:

◁ running master.do → (produces) the final tables and/or the final report

◁ master.do itself is made up of a set of smaller files:

◦ raw.dta→clean.do→clean.dta

◦ clean.dta→recode.do→final.dat

◦ final.dta→tables.do→actual table files

This user guide utilizes L A TEX, along with the previous version of taboutemphasised L A TEX output, to enhance its presentation One of the key benefits of L A TEX is its exceptional typography, which, combined with its ability to support reproducible research, makes it an invaluable tool for researchers.

By executing a master.do file, users can utilize programs like tabout and estout to generate a series of *.tex files Incorporating a simple \input command in the main LaTeX document allows for the simultaneous compilation of tables and other materials, such as graphs, alongside the main text Within seconds, this process yields a complete, publication-quality document Additionally, commands can be included in the master.do file to compile the primary LaTeX file efficiently.

Thus as soon as one runs theStatadofile, all editing is finished; no further tweaking of the tables is needed; the final document is ready for printing or electronic distribution.

The system's efficiency is evident, but its accuracy is crucial By examining all the files that contributed to the final product, any errors or anomalies in the document can be identified and addressed Additionally, this type of system allows for the creation of dynamic documents.

Dynamic documents

Dynamic documents enhance reproducible research by automating the final report, allowing code that generates tables and graphics to be embedded directly within the text This integration eliminates the separation between data presentation and commentary, ensuring that references to specific data in tables are automatically included in the related text Consequently, authors do not need to manually input data results shown in tables A prominent example of this method is Sweave, which operates within the R statistical programming environment.

Sweave home page ics language When it comes to usingStata, users also have a number of

Bill Rising “Dynamic documents in Stata: Many routes to the same goal” Download presentation. options for going down this path, and these were explained in depth in Bill

Rising’s presentation at the Oceania Stata User Group Meeting in 2016.

Dynamic documents can be effortlessly created with tabout, making it ideal for short reports or web pages that require frequent updates from changing data sets A dedicated chapter below will guide you on implementing this method using tabout The core philosophy behind dynamic documents is the concept of 'files communicating with files,' allowing you to develop a comprehensive workflow based on this principle.

In the context of ongoing data collection, researchers can create a master.dofile to systematically clean and recode variables, generating preliminary tables with each new data batch As fieldwork progresses, these tables can be refined to their final format, including stylistic adjustments, and integrated into the report, accompanied by initial commentary This approach provides flexibility, enabling researchers to advance their reports towards completion while still accommodating late-arriving data.

When data changes, it's crucial to consider the weighting of the data While final adjustments to survey weights may occur, this process is straightforward, as updating the weights using master.do will automatically refresh all tables in the report.

The method I've outlined is challenging when relying on a repetitive 'copy and paste' technique This process can be quite tedious, especially when dealing with numerous tables, and it often requires that table formatting be postponed until the end, making it a labor-intensive endeavor.

Becausetabout seamlessly integrates table formatting during the initial table production, ensuring a smooth strategy implementation In the case of L A TEX, there is a complete integration between content and formatting.

In the case ofWord, dynamic documents are also possible and I discuss this later in theUser Guide.

Single source publishing

Single source publishing is a method of document production that utilizes one original source of information to generate multiple outputs, ensuring accuracy and consistency This approach prevents the complications that arise from maintaining unsynchronized information across various platforms, similar to managing an address book in multiple locations The use of Extensible Markup Language (XML) plays a crucial role in this process, enabling the creation of different formats, such as printed newspapers and online content, from a single source Additionally, this method enhances efficiency by eliminating redundant efforts in document creation.

Tabout offers a versatile solution for Stata users, allowing them to generate tables in multiple formats—Word processing, PDF for email or internet sharing, and HTML for website posting—using its new template file option This feature ensures that the same data is presented consistently across all formats, while adapting the code and formatting to meet the specific requirements of each destination.

Tabout is a powerful tool for novice Stata users, enabling the creation of multiple panels of cross-tabulations and flexible data layouts It produces one-way and two-way tables displaying frequencies and percentages, along with summary statistics such as means and medians Additionally, users can incorporate standard errors and confidence intervals using Stata's svy commands, enhancing the analysis's precision and reliability.

Statistics such as chi-squared, Gamma, Cramer’s V, and Kendall’s tau can be displayed at the bottom of each panel Additionally, the formatting of cell contents is user-friendly, enabling users to select the number of decimal places and add percentage or currency symbols as needed.

Version 3 of tabout introduces significant enhancements, including the ability to remove unwanted columns or rows and add new rows after the initial table is created, eliminating the need for variable recoding and addressing issues with missing data for specific categories Additionally, users can now effortlessly add titles and footnotes to their tables, a feature that, while available in Version 2, has been greatly simplified in this latest version.

3.1 tabout in practice: some short examples

This User Guide begins with an introduction to producing tables using the tabout package, highlighting essential examples Before diving into these examples, it's important to prepare appropriate data for the types of tables that will be created.

To effectively utilize the Guide, it's essential to run the provided code at the beginning, which can be copied from the blue link This code employs a built-in Stata dataset and recodes as well as labels the data to enhance table output.

To prepare for the examples in this guide, use the basic Stata code provided, which can be accessed by clicking the link box at the top of the code An internet connection is required to obtain a copy of the code.

The setup code file is referenced in multiple table do files throughout this guide, showcasing its utility This dataset, rich in categorical variables, effectively demonstrates the creation of tables.

The modify options sprinkled throughout this code are there because this allows you to run this code repeatedly without

Copy this setup code set seed 14921918 sysuse nlsw88, clear la var union "Member of a union" la def union 0 "Not a union member" ///

1 "Union member", modify la val union union la var south "Location" la def south 0 "Does not live in the South" ///

1 "Lives in the South", modify la val south south la var race "Race" la def race 1 "White" 2 "Black" ///

3 "Other", modify la val race race la var collgrad "Education" la def collgrad 0 "Not college graduate" ///

The dataset includes variables such as marital status, income, sex, and pregnancy status Marital status is categorized as either "Single" or "Married," while income is generated based on a uniform distribution, with adjustments for lower values The sex of individuals is determined by their weight, with males assigned a value of 1 and females a value of 2 Additionally, a variable for current pregnancy status is included, indicating whether an individual is "Pregnant" or "Not pregnant."

, modify replace pregnant = cond(sex==1, , pregnant) la val pregnant pregnant la var industry "Industry" la var occupation "Occupation"

The following table is produced using the code shown below It illus- trates the most basictaboutcommands.

Does not live in the South 584 58.2 651 57.8 1,235 58.0

To create a table using the specified code, execute the command: `copy table 1 code as: txt tex docx xlsx htm do nlsw_data_setup tabout south race union sex using table1.tex, replace /// c(freq col) f(0c 1) style(tex) font(bold) twidth(11) /// title(Table 1: A Simple Example) fn(Source: nlsw88.dta)` This command generates a formatted table in various file formats, emphasizing frequency and column data with bold font styling.

The code demonstrates that the tabout command functions similarly to Stata's own tabulate and table commands It includes four variables, with the first three designated as 'vertical variables' that form the table panels, while the fourth variable serves as the 'horizontal variable' for cross-tabulation with the others.

The filename in the code follows conventional Stata usage, indicating the output destination Options following the comma allow users to customize their desired output In the context of tabout, multiple options are available for fine-tuning results.

◁ replaceoverwrites the file if it already exists; =⇒

◁ c(freq col) is the contents option, which determines the cell =⇒ contents: frequencies and column percentages;

◁ f(0c 1) is the format option and sets the cell numbers as zero =⇒ decimal points with commas for the frequencies and one decimal point for the column percentages;

◁ style(tex)indicates that the user wants L A TEX output (though one =⇒ can also request ‘pure’ TEX output if desired This is discussed later);

◁ font(bold)turns on bold formatting for the variable labels and the =⇒ second row of the heading;

◁ twidth(11)sets the width of the table to 11 centimetres; =⇒

◁ title(Table 1 etc)is placed above the table; and =⇒

◁ fn(Source etc)is a footnote placed below the table =⇒

Existing taboutusers should be aware of the change in thecoption.

Stata's table command includes a contents option, abbreviated as toc, and earlier versions of tabout used the abbreviation for cells instead In Version 3, tabout has adopted Stata's terminology, which is beneficial since one of the arguments for this option is cell percentage By using the Stata convention of contents(), confusion is minimized, although many users opt for the simpler abbreviation c( ).

The User Guide features a comprehensive Options table for quick reference, offering a wide variety of choices These options primarily exist in two distinct forms.

Table Content 13 3 Table content: overview 14 3.1 tabout in practice: some short examples

Roadmap for Part II

In conclusion, this article offers a brief overview of tabout in practice The subsequent chapters—4, 5, and 6—will systematically explore the various types of tables that can be created using tabout, with each chapter focusing on a specific table type.

◁ chapter 4: basic tables—cross-tabulations of counts and percent- ages;

◁ chapter 5: summary tables—cross-tabulations of summary meas- ures such as means and medians etc;

◁ chapter 6: survey tables—cross-tabulations of counts, percentages and summary measures, with standard errors and confidence inter- vals;

You can choose to read these chapters in order or browse through various examples to find a table that closely matches your desired layout, allowing you to adjust the code as needed To simplify the process, each code block can be easily copied in your preferred output style by clicking the link provided at the top of each section.

When utilizing L A TEX, you can simply copy and paste the text from the code block Additionally, all examples are compiled into a single file for each output style Remember to rename the file extension from txt to do before executing them.

Each chapter begins with a basic table, progressively introducing refinements to meet various requirements This process highlights the inherent trade-off between complexity and flexibility While the tabout syntax aims for simplicity, offering users choices inevitably adds complexity However, these choices are essential for overcoming challenges in creating publication-quality tables Although some users may desire even more options, this would lead to increased complexity.

Chapters 7, 8 and 9 introduce some more advanced features oftabout.

◁ chapter7: how to ‘reshape’ your tables, to drop columns or rows; or to plug gaps in your tables where idiosyncratic variables arise;

◁ chapter8: using template files, a method of simplifying yourtabout code and sharing taboutcode between colleagues and with begin- ners;

◁ chapter 9: how you can build dynamic documents withtabout, or, at a minimum, how to implement some of the principles of reprodu- cible research.

Basic tables 23 1 Twoway tables

This chapter explores the essential features of basic tables, specifically focusing on one-way and two-way cross tabulations of categorical data, referred to as "istabout." Utilizing the nlsw.dta dataset from the Overview chapter, it also incorporates data from the built-in Statadata set, cancer.dta Initial setup is required to convert a continuous variable into a categorical one for analysis.

This fundamental Stata code is essential for preparing supplementary data utilized in the examples throughout this guide To obtain a copy of the code, simply click the link box located at the top of the code, ensuring you have an active internet connection.

The setup code file is referenced within several table do files in the upcoming chapters, utilizing a dataset that includes a diverse range of both categorical and continuous variables.

Copy this setup code sysuse cancer, clear la var died "Patient died" la def ny 0 "No" 1 "Yes", modify la val died ny recode studytime ///

, gen(stime) la var stime "To died or exp end" la var drug "Drug type" la def drug 1 "Placebo" 2 "Trial drug 1" ///

3 "Trial drug 2", modify la val drug drug

Unlike Stata's tabulate command, which presents results in a fixed sequence of frequency, row percentage, and column percentage, the tabout command offers the flexibility to customize the order of your results.

The following table repeats some of the features oftaboutdiscussed in the

Overview chapter, and introduces some new ones One thing to notice is that the contents option contains a cumulative percentage, a feature not readily available withStata’s owntabulatecommand.

Table 4: Example of a simple cross tabulation

To died or exp end

To create a simple cross tabulation using Table 4 code, copy the following command: `txt tex docx xlsx htm do cancer_data_setup tabout stime died using table4.tex, replace /// c(freq col cum) style(tex) font(italic) twidth(14) /// f(0 1) clab(No Col_% Cum_%) title(Table 4: Example /// of a simple cross tabulation) fn(Source: cancer.dta)` This command will generate a well-structured table that presents frequency, column percentages, and cumulative percentages, formatted in italics and with a specified width for better readability.

This table illustrates the distinction between column and cumulative percentages by overriding the default percentage symbol in the third heading row While it's possible to suppress this row using h3(nil), you can also customize its labeling by inserting your own terms within the h3 option However, a more straightforward approach is to utilize the theclab(column label) option.

In most cases, users primarily need to modify the third heading row, which is the purpose of the "theclab" option shown in Table 4 This straightforward solution allows for easy substitution of an alternative set of column headings.

In Stata, using underscores instead of spaces is uncommon but is a standard practice for file naming, helping to prevent issues associated with spaces This convention is particularly important when using tabout for options that include labels with spaces If column headings contain spaces, such as "Col %," underscores must be utilized in the yourtabout syntax Fortunately, tabout removes these underscores during table generation, ensuring that the final output displays normal spaces.

Table 5 uses panels, one of the key concepts in taboutand intrinsic to its design philosophy of visual comparisons.

Table 5: Example of cross tabulation using panels

Does not live in the South 4,941 1,516 6,458

Does not live in the South 76.5 23.5 100.0

Does not live in the South 57.4 58.1 57.6

To create a cross-tabulation table using Stata, copy the following code: `copy table 5 code as: txt tex docx xlsx htm do nlsw_data_setup tabout south race collgrad [iw=wt] using table5.tex, /// replace style(tex) font(bold) c(freq row col) /// f(0c 1 1) layout(rb) h3(nil) twidth(11) /// title(Table 5: Example of cross tabulation /// using panels) fn(Source: nlsw88.dta)` This command generates a formatted table that displays the relationship between variables in your dataset.

A table allows for quick comparisons of educational backgrounds alongside two other variables, enabling users to view multiple comparisons efficiently in a compact layout Specifically, Table 5 employs a row block choice layout, arranging the cell contents—such as frequencies and row and column percentages—in a horizontal format rather than vertical columns.

In tables like Table 5, using the h3(nil) option is necessary to eliminate unnecessary headings in the third row, but this only impacts the heading rows at the top Consequently, the percentage symbols reappear in the intervening row blocks, which may not align with user preferences For those looking to remove these symbols and clearly indicate percentages, Table 6 on the following page offers an effective solution.

To achieve the results displayed in Table 6, utilize the clab option with h3(nil), which affects all instances of column headings throughout the table, regardless of their position To create an 'empty' column heading, insert blank spaces in the labels, using an underscore for each column in the table; in this case, there are three columns.

Hence the syntax: clab(_ _ _) You then need to add the p symbol in your format option to show percentage symbols alongside each number: f(0 1p 1p) =⇒

Table 6: Same example with refinements

Does not live in the South 4,941 1,516 6,458

Does not live in the South 76.5% 23.5% 100.0%

Does not live in the South 57.4% 58.1% 57.6%

To generate Table 6 with refinements, use the command: `copy table 6 code as: txt tex docx xlsx htm do nlsw_data_setup tabout south race collgrad [iw=wt] using table6.tex, replace style(tex) font(bold) c(freq row col) f(0c 1p 1p) layout(rb) clab(_ _ _) h3(nil) twidth(11) title(Table 6: Same example with refinements) fn(Source: nlsw88.dta)` This command specifies the output format and styling options for the table.

One of the standout features of tabout is its ability to integrate sample counts and statistics within descriptive tables, offering significant flexibility In Version 2, users could display sample counts in either columns or rows with custom labels, but statistics were limited to rows without label customization Version 3 enhances this functionality, allowing users to position statistics in columns, customize labels and formats, and organize the layout of statistics along with their p-values Additionally, there are improved options for p-value presentation, which can now be displayed as stars or ranges.

Table 7 shows the default values for these options, applied to a Pear- son’s chi-squared statistic Table 8 shows a number of customisation fea- tures:

◁ custom labels for sample size and for statistics;

◁ column position of statistics; and

◁ display of p-values as stars.

Table 7: Example of sample counts and stats

Does not live in the South 65.4 36.0 88.5 58.1

To generate Table 7 in various formats, use the command `copy table 7 code as: txt tex docx xlsx htm do nlsw_data_setup tabout south collgrad race using table7.tex, replace /// style(tex) font(bold) c(col) f(1) npos(row) /// twidth(12) clab(Col_%) stats(chi2) title(Table 7:` This command allows for the export of statistical results while customizing the output format, font style, and column width, ensuring clarity and accessibility of data presentation.

Example of sample counts and stats) fn(nlsw88.dta)

The novel aspect to Table 7, the statistics, makes use ofStata’stabulate command Thustabout’sstatsoption uses the same measures: Pearson’s =⇒ chi-squared (chi2), Goodman and Kruskal’s gamma (gamma), Cramér’s V

(V), Kendall’s tau-b (taub) and the likelihood-ratio chi-squared (lrchi2).

Table 7 shows the default settings and labels for thechi2 statistic.

Customisation of some of these settings is shown in Table 8 In partic- ular:

◁ stpos(col)(statistics position) which is in the column, rather than =⇒ the default row position;

◁ stlab(Chi2)(statistics label) which uses a shorter phrase to fit the =⇒ column width;

◁ stform(2)(statistics format) is set to 2 decimal points (the default =⇒ is 3) There is also an equivalent pform option for formatting the =⇒ p-value.

◁ plab(Signif)(p-value label) which also uses a shorter phrase to fit =⇒ the column width;

◁ starswhich indicates that statistical significance should be shown =⇒ according to the stars convention, rather than an explicit p-value be shown.

Summary tables 33 1 Twoway summary tables

Summary tables in Stata are generated using the summarize command, which organizes various summary measures into a table format For cross-tabulations, where vertical variables are compared against a single horizontal variable, only one summary measure can be displayed in the cell at their intersection Conversely, when creating a one-way table that utilizes only vertical variables, multiple summary measures can be included horizontally across the table, depending on available space The following examples will illustrate these concepts more clearly.

To create summary tables in tabout, it is essential to use the thesum option, which indicates that the table should utilize summary measures rather than counts or percentages The specific summary measures are defined within the contents option, which employs a different syntax than basic tables, as it includes the names of other variables For example, Table 10 demonstrates the application of the mean measure, a syntax familiar to users of Stata’s table command, where you specify the summary measure (mean) followed by the variable name (weight).

Table 10: Simple twoway summary table of means

Car type (mean weight in lbs.)

To create a summary table of mean weights for different car types, use the command `tabout` in Stata with the following syntax: `tabout rep78 foreign using table10.tex, replace style(tex) font(italic) c(mean weight) f(0c) sum twidth(9) h1(Car type (mean weight in lbs.)) h3(nil) title(Table 10: Simple twoway summary table of means) fn(auto.dta)` This command generates a LaTeX table file, formatted with italicized text, displaying the average weight of cars based on their type.

The table features refinements that eliminate the repetition of "Mean weight," enhancing clarity Additionally, the heading "Car type (mean weight in lbs.)" has been updated to accurately reflect the content of the cells.

Table 11 shows another twoway summary table, in this case using me- dian measures.

Table 11: Simple twoway summary table of medians

To generate a table summarizing median values for candidates, execute the command `tabout inc candidat using table11.tex, replace /// style(tex) font(italic) c(median pfrac) f(1) clab(%) /// sum twidth(9) title(Table 11: Simple twoway summary /// table of medians) fn(voter.dta)` after copying the code for Table 11 in formats such as txt, tex, docx, xlsx, and htm.

Table 11 displays percentage values due to the variable pfrac being a percentage measure, making interpretation somewhat challenging This example serves to illustrate the syntax of the tabout function effectively.

Basically, the table presents the breakdown of Presidential votes in 1992 according to the voter’s family income, showing the median percentage vote for each candidate within each income bracket.

Turning now to oneway tables, the use of multiple measures is illustrated in

Table 12 presents two vertical variables without a horizontal variable, resulting in columns filled with summary measures, including means for three variables and medians for two.

Table 12: Oneway summary table with multiple summary measures

MPG Weight (lbs) Length (in) Price Headroom

To create a table in Stata, use the command `tabout foreign rep78 using table12.tex, replace`, specifying the output format as LaTeX Customize the table with options such as `style(tex)`, `font(bold)`, and `twidth(13)` Include summary statistics for variables like mean miles per gallon (MPG), mean weight, mean length, median price, and median headroom Format the output using `f(1c 1c 1c 2cm 1c)` for precision, and set headers with `h2(Mean Median)` and `h2c(3 2)`, while labeling columns as MPG, Weight (lbs), Length (in), and Price.

Headroom_(in)) title(Table 12: Oneway summary table ///

\\ with multiple summary measures) fn(Source: auto.dta)

What is notable in Table 12 is:

◁ the syntax for thecontentsoption: where each summary measure =⇒ is followed by a variable name: c(mean mpg mean weight mean length );

◁ theonewayoption isnotneeded here becausetaboutis restricted to =⇒ only producing oneway tables when you request multiple statistics across the columns;

◁ the npos(tufte)option, which places the distribution of the cat- =⇒ egories within the two ‘vertical’ variables within their labels;

The tufte option is named after the approach adopted by Edward Tufte in his construction of a

‘supertable’, which he designed for the New York Times in 1980. See Tufte2001.

◁ the use of a L A TEX new line symbol (\\) in the title improves its ap- pearance (both the tex andhtm output styles allow codes in your title and footnote options);

◁ the use of theh2option in conjunction with theh2coption.

This last item is worth further discussion Headings are highly custom- isable intabout and this is done with the h1, h2 andh3options As we =⇒ =⇒ =⇒

To customize your table headings, you can insert your desired words into the options provided, ensuring they appear in the correct columns and span the appropriate number of columns If you're using the tex or html output styles, you have the option to write your own code Alternatively, you can allow Tabulate to handle this automatically, which is compatible with all output styles Note that placing nil in any of the options will exclude that row from the final table.

Tabout determines column placement by using spaces to separate words, similar to the clab option, while underscores are required for phrases that contain spaces The process for spanning columns is more complex and involves specific conventions to achieve the desired layout.

‘partner’ options: h1c,h2candh3c, all of which stand forheading columns =⇒ =⇒ =⇒

By inserting numbers in these options, you telltabout which columns to span with the corresponding words found in their ‘partner’ h1, h2 or h3 option.

The presence of the 'partner' option in the h2 tag indicates that it should be treated differently than user-generated code When this option is detected, the system processes the h2 content automatically Conversely, if the 'partner' option is absent, the system assumes that the h2 text is entirely user-created and inserts it without modification.

In Table 12, the Mean label spans three columns while the Median label spans two, specified by the option h2c(3 2) This may seem complex, but it actually simplifies the process For those seeking full customization of headings and comfortable with coding, the h2 function remains available However, if you frequently use h2 with summary tables, this straightforward shortcut could be ideal for you.

This issue highlights the interconnectedness of aesthetics and information decoding While h2c functions effectively across various output styles by spanning multiple columns and centering labels, its role in TeX output is particularly significant This option controls the placement of breaks in heading lines, creating a cleaner appearance and clearly indicating which columns correspond to the 'Mean' label and which to the 'Median' label Although the distinctions may be apparent at times, the use of line gaps reinforces the associations between the data.

When creating summary tables, it's common to encounter issues with default headings generated by tabout, which may not meet specific requirements For example, Table 13 demonstrates the limitations of default column headings in a one-way table, where the third heading row simply repeats the variable name While tabout could use the summary measure name alongside the variable, these options often result in cryptic or overly lengthy headings that do not fit well within the columns Customizing headings is essential for clarity and effective presentation in summary tables.

Table 13: Oneway summary table with default headings age age studytime studytime studytime

To create a comprehensive summary of the cancer data analysis, copy the code from Table 13 in the specified formats: txt, tex, docx, xlsx, and htm Utilize the command `died drug using table13.tex` and modify the style with `/// style(tex) font(italic) twidth(12) sum f(1)` Include key statistics such as mean age, interquartile range (IQR) of age, median study time, and the minimum and maximum study times Title the output as "Table 13: Oneway summary table with default headings" and cite the source as "Source: cancer.dta."

Survey tables 39 1 Basic tables with survey data

Stata offers powerful survey capabilities, allowing users to efficiently analyze complex survey data with the svy prefix command It is important to note that point estimates can be significantly influenced by the survey design.

For more discussion on this issue see the Stata manual entry

The svy command in survey analysis accounts for weights but may overlook other critical elements of survey design, which can significantly impact standard errors As a result, confidence interval estimates may be misleading, especially when subjects are clustered, highlighting the necessity for researchers to consider the full survey design in their analyses.

According to the Stata manual, when utilizing the various svy commands, it is advisable to employ the subpopulation option in conjunction with the if or in conditions This method operates seamlessly in the background, enabling users to easily specify if or in as they typically would.

6.1 Basic tables with survey data

The basic tables produced bytaboutwhen thesvyoption is chosen provide =⇒

To obtain confidence intervals in Stata without frequently using svy commands, you can set your weight variable with the svyset command and analyze your data as if it were complex survey data There is no requirement to specify strata or primary sampling units (PSU) If weights are unavailable, you can simply create a weight variable set to one.

To analyze survey data effectively, begin by using the svyset command and then apply the svy option in the tabout function This approach allows you to create basic tables that display similar cell contents, excluding cumulative percentages It's important to note that only one of the specifications—frequency (freq), cell, row, or column—can be selected at a time However, you can incorporate multiple standard survey estimates, such as standard errors (se), confidence intervals (ci), lower bounds (lb), and upper bounds (ub) Essentially, these basic tables are designed to provide a primary key point estimate alongside various uncertainty estimates, enhancing the interpretation of survey results.

One major disadvantage in using the svy commands inStata is that the standard displays produced are not suited to publication-quality tables.

The default tables generated from the Stata commands demonstrate the relationship between race and diabetes, as well as sex and diabetes, using the NHANES dataset By applying survey settings with appropriate weights and strata, the analysis presents the data in a clear format, highlighting confidence intervals for each category.

The current layout poses challenges for converting data into a publication-quality table, particularly due to the placement of confidence intervals below point estimates, which may not align with your requirements Additionally, this analysis necessitates the use of two separate tables In contrast, tabout simplifies this process by consolidating the results into a single, cohesive table.

No Yes Total Sample size

Prop CI Prop CI Prop.

To create Table 16 from the NHANES dataset, use the command `copy table 16 code as: txt tex docx xlsx htm` and access the data at "http://www.stata-press.com/data/r14/nhanes2b" Set the survey design with `svyset psuid [pweight=finalwgt], strata(stratid)`, and label the variables for race, sex, and diabetes using `la var race "Race"`, `la var sex "Sex"`, and `la var diabetes "Diabetes"` Define diabetes categories with `la def ny 0 "No" 1 "Yes", modify` Generate the table with `tabout race sex diabetes using table16.tex, replace` and apply formatting options such as `style(tex)`, `font(italic)`, and `stats(chi2)` Customize the appearance with parameters like `cisep(-)`, `h2c(2 2 1)`, and `twidth(16)`, and include the title "Table 16: Survey data example" with a source note stating "Source: nhanes2b".

When using the svyoption in Stata, it's crucial to indicate that the table is a survey table Additionally, you must inform Stata that the data is survey data by employing the svyset command, along with defining the necessary survey settings, such as weights and strata Another important feature in this code is the c(row ci) option, which requests row percentages and confidence intervals The cisep(-) option allows you to choose how the confidence intervals are separated, with a hyphen being used in this instance, although any symbol can be specified.

In statistical reporting, confidence intervals are typically presented using square brackets, while standard errors are shown in parentheses The options 'cibnone' and 'sebnones' can be used to suppress these brackets if needed It's important to note that confidence intervals do not have to be confined to a single column, which can lead to layout issues; instead, the 'tabout' function allows for the specification of lower and upper bound values in separate columns, providing greater flexibility in data presentation.

For those using L A TEX, Table 16 illustrates the use of theltrimoption =⇒ which makes the gaps in these lines larger than the default, which is 1

(measured in ems) Having gaps in heading lines may seem a small refine- ment, but they make the table more readable.

For L A TEX users, Table 16 shows an additional feature ofh2c, the option =⇒ which was introduced earlier as the ‘partner’ to theh2option Hereh2cis =⇒

When using the 'flying solo' option, it is important to correctly position the gaps in the heading row without needing the h2 option, as the default labels suffice The absence of h2 can lead to default lines extending into the final column, as illustrated in Table 17, where the 'Obs' entries are also underlined If this format does not meet your needs, you have the option to customize the default lines by specifying your own, as demonstrated in Table 16.

I use thish2coption for the lines, so you should compare those tables with and without this feature to see which you prefer.

Turning now to Table 17, it repeats Table 16 but with thecontents =⇒ option using theub (upper bound) andlb (lower bound) choices to display the confidence intervals.

Table 17: Survey data example with lb and ub options

Prop LB UB Prop LB UB Prop.

Source: nhanes2b Note: lb lower bound; ub upper bound.

The following code is used to generate Table 17 from the NHANES dataset, which includes analysis of race, sex, and diabetes status The command `use "http://www.stata-press.com/data/r14/nhanes2b", clear` loads the dataset, while `svyset psuid [pweight=finalwgt], strata(stratid)` sets the survey design Variable labels for race, sex, and diabetes are defined, and the diabetes variable is categorized into "Yes" and "No" The `tabout` command exports the results to a LaTeX file named `table17.tex`, with specified formatting options and statistical outputs, including chi-squared tests The final output is titled "Table 17: Survey data example with lb and ub options" and cites the NHANES source.

Note: lb lower bound; ub upper bound.)

Table 17 also illustrates the use of thedpc(decimal point comma) op- =⇒

Arjan Soede has contributed code for the dpcomma option, enabling European users to use commas for decimal points and periods for thousands While the default labels (LB and UB) are utilized, they can be customized using the theclab option.

=⇒ case, the table footnote (viafn()) explains to the reader what the abbrevi-

Table 18 presents the same data with additional refinements, displaying the point estimate as a percentage While standard cross-tabulations typically use percentages, Stata's svy: tabulate command generally presents results as proportions To convert these results into percentages, the multiplier option in the tabulate command must be set accordingly.

The mult option replaces the percent option from tabout

Version 2 Thanks to Peter Young for this contribution. to 100 If you wanted rates (for example, mortality rates) based on another denominator, such as 1000, you would specifymult(1000).

The standard error serves as the uncertainty measure, which is displayed by default in parentheses by tabout To eliminate these parentheses, you can use the option named "sebnone."

SE brackets none) Note that the cell formatting has changed, withf(1 3) =⇒ specifying that the percentages are to be shown to 1 decimal point and and the standard errors to 3.

Table 18: Survey data example with standard errors

Reshaping tables 50 1 Removing unwanted columns or rows

Version 2 oftabouthad the capability of dropping the total rows in panels.

To avoid repetition of identical totals in every row, users can utilize the 'ptotal(none)' option, which effectively removes all panel totals.

The ptotal option code is still present in tabout.ado, but it currently produces inconsistent results I appreciate Kevin Baier for highlighting this issue In Version 3 of tabout, the ptotal(single) option, which previously allowed for the display of all rows except one at the bottom of the table, is no longer supported Users can now easily remove any row they desire For guidance on achieving ptotal-like outcomes in Version 3, please refer to the Tips and Tricks section of the User Guide.

In Version 3, users can finally remove unwanted columns, addressing a common request that was not possible in Version 2 This new feature allows for the removal of total columns as well as any other specified columns, while also enabling users to fill in gaps effectively.

The ptotal option can be misleading, as it calculates table totals based on figures from the last panel, which may not accurately represent all panels This can lead to discrepancies, especially in tables where certain categories are consistently absent.

The phenomenon of 'pregnant men' can lead to misalignment of columns, a concept that will be illustrated shortly Additionally, the same dropping and plugging feature is applicable to rows, serving as a replacement for the previous ptotaloption.

7.1 Removing unwanted columns or rows

This operation relies on index numbers, allowing users to identify specific columns or rows by their numerical positions The functionalities for this are referred to as dropc for columns and dropr for rows Before delving into the complexities, let's illustrate the concept with an example of a problem and the solution provided by tabout.

In Table 22 the ‘Other’ category is very small, yet takes up two columns.

The total column effectively shows row percentages but occupies considerable space; recoding the 'Other' category as missing would lead Stata to disregard it, resulting in inaccurate total counts and percentages.

Does not live in the South 5,248 81 1,086 17 123 2 6,458 100

To generate Table 22 in various formats such as TXT, TEX, DOCX, XLSX, and HTML, use the following command: `copy table 22 code as: txt tex docx xlsx htm do nlsw_data_setup tabout south sex union race [iw=wt] using /// table22.tex, replace style(tex) font(bold) f(0c) /// c(freq row) twidth(14) /// title(Table 22: Unnecessary /// columns) fn(Source: nlsw88.dta)`.

The solution is presented in Table 23, which omits columns 6, 7, and 9, while the footnote clarifies that the ‘Other’ column is excluded The column labels denote that the values represent ‘row %’ This adjustment results in a more concise table, ideal for situations where space is limited.

Because of the need to get the indexing correct when dropping columns, usingdropc(6 7 9),taboutoffers an additional category in theshowop- =⇒

The new feature, named "prepost," allows users to view the matrices before and after column reshaping, ensuring accurate indexing Previously, the "tabouthas" option displayed the output by default, but selecting "all" revealed the underlying matrices With the introduction of "prepost," users can now easily compare the two sets of matrices, enhancing their data analysis capabilities.

No Row % No Row % No.

Does not live in the South 5,248 81 1,086 17 6,458

Source: nlsw88.dta Note that Other category has been omitted, so totals will not be accurate.

To copy Table 23 in various formats such as TXT, TEX, DOCX, XLSX, and HTML, use the command: `nlsw_data_setup tabout south sex union race [iw=wt] using /// table23.tex, replace style(tex) font(bold) f(0c) /// c(freq row) twidth(12) dropc(6 7 9) show(prepost) /// clab(No Row_%) h2c(2 2 1) title(Table 23: Dropping /// columns) fn(Source: nlsw88.dta Note: "Other" category has been omitted Totals will not be accurate.)` This command formats the table by dropping specified columns and includes a source note for clarity.

Table 24 presents the same data with swapped variables, illustrating how rows are eliminated Although the operation involves removing the 'Other' category from the race variable, the implementation differs slightly Since tabout functions with panels, it is necessary to specify both the panel number and the row number, using the format dropr(3:5).

The 5th row in the panel may not be immediately apparent, but the show(prepost) feature reveals hidden heading rows (h2 and h3) that are integral to each panel Typically, these headings are not visible because of tabout's housekeeping, which replaces them with suitable labels Additionally, phrases marked with exclamation points are also part of this housekeeping process In summary, it's important to remember that there are always two additional rows beyond the actual data rows in a panel, which should be considered during indexing.

Not a union member Union member Total

Does not live in the South 3,665 52 1,589 70 5,254 57

Source: nlsw88.dta Note that Other category has been omitted, so totals will not be accurate.

To create Table 24, use the following code: `copy table 24 code as: txt tex docx xlsx htm do nlsw_data_setup tabout south sex race union [iw=wt] using /// table24.tex, replace style(tex) font(bold) f(0c) /// c(freq col) twidth(14) dropr(3:5) show(prepost) /// title(Table 24: Dropping rows) fn(Source: nlsw88.dta` This command allows for the generation of a formatted table while excluding specific rows, ensuring clarity in data presentation.

Note: "Other" category has been omitted Totals /// will not be accurate.)

To drop multiple rows using the drop option, separate your choices with a space while ensuring that there are no spaces on either side of the colon For example, if you wish to drop specific rows, follow this formatting guideline.

‘male’ category from the sex variable, as well as the ‘other’ category from the race variable, you could specify:dropr(3:5 2:3)ordropr(2:3 3:5).

Unless a total is involved, it doesn’t matter what order you specify these rows in, but you must always have the panel number first, followed by the

Template Files 63 1 Introduction

The syntax for tabout can become lengthy, often exceeding six lines when users specify numerous options This complexity is a trade-off for the flexibility that tabout provides To enhance manageability, tabout includes numerous small options with cryptic names and supports abbreviations.

Copying and pasting code between tables in Stata, while making minor edits, can lead to errors that may go unnoticed until the final table is generated To avoid such mistakes, using template files is an effective solution.

A template file is a simple text file where each tabout option is placed on a new line You can easily create one by editing your do file that contains the tabout code and saving it with a txt extension, although other formats are acceptable When creating the template, ensure to remove any unnecessary code and place each tabout option on a separate line The first line should be reserved for your own use, such as a description of the template's purpose and the creation date.

A template file should be structured by separating the code for a table into generic and specific options Specific elements, such as the variable list, file name, and table title, belong in the tabout code within your do file In contrast, generic features like style, format, layout, labeling, and footnotes are typically included in the template file.

Your can then attach that template to a batch of tables using thetpoption =⇒

When executing your main tabout do file, each table will yield distinct results based on its specific code; however, all tables will share a common set of characteristics known as generic features.

The template file contains the generic code necessary for Tabout to create final tables Tabout combines your specific code from the do file with the generic code from the template file, effectively generating tables that replicate the outcome of a manual process.

The advantages of template files are obvious:

◁ the complexity in your code is reduced considerably;

◁ you can share template files with your colleagues, or with the wider

◁ tabout novices can be given template files to make the learning curve easier;

Single source publishing simplifies the process by allowing one set of template files to generate various formats, such as a LaTeX document for PDF distribution, HTML files for the website, and Excel files for archiving.

◁ tables for journals or reports can change their appearance to suit the audience by switching templates;

◁ consistent tables for batch production are made easy, for example, appendix tables or standardised reports.

The code from Table 9 is as follows: "do nlsw_data_setup tabout industry occupation [iw=wt] using table9.tex, replace style(tex) font(bold) oneway c(freq col cum) f(0c 1) clab(Count Col_% Cum_%) twidth(11) npos(col) nlab(Sample) title(Table 9: A oneway table) fn(Source: nlsw88.dta)."

The code presented is largely generic, leading to the creation of a template file saved as plain text under the name oneway_basic_b.txt Additionally, you may have observed that the example files incorporate letters such as a, b, c, d, and an indicator of their output style at the end of their filenames.

In this case, it's important to pay attention to the filename, as it needs to be referenced correctly in the template example Keep in mind that different templates feature varying contents based on their specific output styles.

In the main body of the report dated November 2016, copy the template code for various formats such as TXT, TEX, DOCX, XLSX, and HTML under the identifier oneway_basic_b Ensure that the style for the TEX format is set to bold font, and include frequency content in columns with cumulative formats, labeled as Count, Col_%, and Cum_% with a total width of 11 Position the sample label appropriately and reference the source as nlsw88.dta.

The initial line provides a clear description, while subsequent lines feature taboutoptions formatted similarly to the original code, excluding line continuation symbols The fnoption is considered generic, although some users may opt for specific code Additionally, the User Guide's conclusion illustrates how to pass arguments to footnotes and titles using the older tabout topf and botf options, which effectively integrates with the new template system.

The provided code in the user's do file for table creation generates results identical to those in Table 9, producing what is shown in Table 32.

When creating a template file, it is important to avoid abbreviations for better self-documentation Typically, the replace option is used here, unless you are compiling multiple tables into a single file with the append option While it is possible to omit the replace option, doing so may lead to repetitive Statamessages when running the code multiple times, which is common in batch processing or during the initial table creation.

Table 32: A oneway table using a template

To generate a one-way table using a template, copy the code from table 32 in formats such as txt, tex, docx, xlsx, and htm Utilize the command `nlsw_data_setup tabout industry occupation [iw=wt] using table32.tex` along with `tp(oneway_basic_b.txt)` to obtain the desired results This process will create a formatted output titled "Table 32: A one-way table using a template."

Table styles 74

Ngày đăng: 02/09/2021, 16:42

w