Title

number_exporting - number_exporting formats a given numeric value (numeric_value) based on user specifications. It outputs the formatted number into a LaTeX compatible .tex file that can then called directly into the paper.
The function can handle absolute values, percentages, and specific decimal formatting, making it suitable for saving numeric data for reports or publications in LaTeX format and automatized the description of regression coefficients in the main
text of a paper.

Syntax

number_exporting numeric_value [, options]

Description

number_exporting number_exporting formats a given numeric value (numeric_value) based on user specifications and outputs the formatted number into a LaTeX compatible .tex file.

Options

name(string): Specifies the name of the output .tex file (there is no need to add the extension). This is a required option and determines the file name of the output.

percent: If specified, the number is treated as a percentage. This means the number will be multiplied by 100 and formatted with a percentage sign at the end for the LaTex output.

absolute: If specified, the absolute value of 'numeric_value' is taken before formatting.

digits(integer): Determines the number of decimal places in the formatted output. If not specified, the default is 2 decimal places.

Usage Examples

Assume that you estimate a regression of the form: Y = DiD
and the output is: _b[DiD] = -0.04568

1) Formatting a standard number without percentage or absolute transformations.
Typing:
number_exporting `_b[DiD]', name(example) digits(3)
Produces an output file example.tex with the content "-0.046" in the working directory.

2) Formatting a number as a percentage with absolute value transformation.
Typing:
number_exporting `_b[DiD]', name(percentage) percent digits(1) absolute
Produces an output file percentage.tex with the content "5%" in the working directory.

3) Formatting a number as a percentage with absolute value transformation and using a global as a path.
Typing:
number_exporting `_b[DiD]', name($result/percentage) percent digits(1) absolute
Produces an output file percentage.tex with the content "5%" in the folder where the global $result points to.

Note

All the output.tex files end with a ``%'' sign. This is because otherwise, inputting the .tex in a Latex document creates an extra space and include ``%'' at the end of the output.tex deals with this problem.

Authors

Olena Bogdan (obogdan@g.harvard.edu), Adrien Matray (matray@stanford.edu), Pablo E. Rodriguez (pablo6@mit.edu), Chenzi Xu (chenzixu@berkeley.edu).

Comments

Send any suggestions or feedback to Pablo E. Rodriguez (pablo6@mit.edu).