Stata | Export to Excel, Word, LaTeX | median table
median
performs a nonparametric K-sample test on the equality of medians. It tests the null hypothesis that the K samples were drawn from populations with the same median. For two samples, the chi-squared test statistic is computed both with and without a continuity correction. To export the output of median
command, we need to add asdocx to the beginning of the Stata command. See the following example. The default of asdocx is to export to MS Word.
* Load some example data sysuse nlsw88 asdocx median wage , by(race)
Greater than the median | race | |||
---|---|---|---|---|
white | black | other | Total | |
no | 772 | 341 | 10 | 1123 |
yes | 865 | 242 | 16 | 1123 |
Total | 1637 | 583 | 26 | 2246 |
Pearson Chi2 | 23.48 | |||
Prob. | 0.0000 | |||
Notes: |
Export to Excel
To export the results of the median
command to MS Excel, use option save(Filename.xlsx). So, if we were to export the results to file Median Table.xlsx
, the code would be:
* Save the output to Excel file
asdocx median wage , by(race) save(Median Table.xlsx)
The above code generates the following table in MS Excel. The table title is added automatically. If you like to specify your own title for the table, then use the option title().
Export to LaTeX
Similarly, should we wish to export the outcomes of the median
command to a LaTeX file, the appropriate extension would be .tex
. Consequently, the contents within the save() option would be specified as save(Median Table.tex)
* Save the output to LaTeX file
asdocx median wage , by(race) save(Median Table.tex)
The above code generates the following LaTeX table.
Order asdocx
Yearly license of asdocx is available at $9.99. Its life-time license is available at $49.99. With the asdocx membership, you get :
- Life-time license to use
- All future updates
- All premium templates / plugins.