help for tabxml

Title

tabxml - Save results in XML format for use in Microsoft Excel and
OpenOffice Calc

Syntax

tabxml [, options]

options

variables
dv(varname) dependent variable

ivd(varlist) independent discrete variables

ivc(varlist) independent continuous variables

split(varname) split data into subgroups

Output
save(string) name of the output file

options(varlist) select output for independent variables

order(varlist) order of independent variables

display display output

Conditions
cond(string) condition - modifies total population size

subcond(string) sub condition - creates a sub population

Table Formatting
percent(string) select percent type for discrete variables

tformat(string) select decimal places for output

justify(string) data alignment

rotate(string) rotate dependent variable labels

labrown(string) determines the way the 'n' counts are displayed
for the independent variables

labcoln(string) determines the way the 'n' counts are displayed
for the dependent variable

bold make independent variable names bold

olines omit lines between independent variables

otab omit indentations from indepedent variable labels

sp show the % symbol for all percents

chi2 display chi2 statistic for all independent variables

chidec(integer) number of decimal places for chi2 statistic

pval display p-value for all independent variables

pdec(integer) number of decimal places for p-value

Excel/Calc Paths
excelpath(string) select directory for Excel

calcpath(string) select directory for Calc

svy options
osvy data is not svy

Description

tabxml export Stata output directly into an XML file that could be opened with
Microsoft Excel or OpenOffice Calc. The program is relatively flexible and
produces journal quality tables in Microsoft Excel or OpenOffice Calc; and
allows users to apply different formats to the elements of the output table and
essentially do everything Microsoft Excel or OpenOffice Calc can do in terms
of formatting from within Stata as oppose to using an external package like LaTex. A key
feature includes displaying trailing zeros after decimal places.

tabxml can create formatted tables of frequencies and/or percents for discrete
independent variables, means and standard errors / confidence intervals for continuous
independent variables. Two-way tables can be ceated by selecting a dependent variable.
Multiple independent variables are permitted.

Options

Output

save(["]filename["]) specifies a name for XML file where tables are outputted.
Files are saved in a folder named "Excel" which is created (if missing) in the current
directory. If save(["]filename["]) is omitted, the output will be saved in tab_out.xml
located in the current working directory.

options(varlist)} modify output type for discrete and continuous independent
variables. Output type options for discrete independent variables include (n) displayed
"n" or (per) displayed "per". Note default output is "n (per)". Output type options for
continuous independent variables include (mean) displayed "mean", or (mean ci) displayed
"mean (CI)". Note default output is "n (SE)". If split is specified option(nototal)
only outputs the subgroups of split and omits the totals.

order(varlist)} rearrange order of independent variables. Default order of
independent variables is ivd(varlist) followed by ivc(varlist). To rearrange
the order of the independent variables write the varlist of discrete independent
variables and continuous independent variables in the order you wish them to appear.

display displays the output in Stata.

Conditions

cond(string) reduces the population size of the dataset to meet the condition.
For example cond(panel==1) reduces the populations size such that the variable panel
equals one.

subcond(string) creates a sub population of the total population.
For example subcond(age>30) creates a sub population such that the age of the
respondents is greater than 30.

Table Formatting

percent(string) tables for independent discrete variables can be either row
or column (col) percents. Default is column percents.

tformat(string) modify the number of decimal places for table percents for discrete
independent variables; and means, confidence intervals and standard errors for continuous
independent variables. Default is two decimal places.

justify(string) justify the output of the data. Left (l), right (r) and centre (c)
justify. Default justify is left align.

rotate(string) rotate the variable labels of the dependent variable. For example,
rotate(60) produces a pleasing effect. Default is horizontal variable names.

labrown(string) if this option is specified counts are now included in the
variable labels of the independent variables. For example, label(n=) produces
the variable label followed by (n=#) where # is the count.

labcoln(string) if this option is specified counts are now included in the variable labels
of the dependent variable. For example, label(n=) produces the variable label followed by
(n=#) where # is the count.

bold makes the independent variable names bold face.

olines omit lines between independent variables.

otab omit indentations from indepedent variable lables.

sp show the % symbol for all percents.

chi2 display chi2 statistic for all independent variables.

chidec(integer) number of decimal places for chi2 statistic. Default is 2 decimal
places.

pval display p-value for all independent variables.

pdec(integer) number of decimal places for p-value. Default is 2 decimal
places.

Excel/Calc Paths

excelpath(string) select the full directory for Excel to open the file from Stata.
Default is "C:/Program Files/Microsoft Office/office*". Where * represents the current
version of office. This option is particulary useful when Office is not on the C:\ drive.

calcpath(string) select the full directory for Calc to open the file from Stata.
Default is "C:/Program Files/OpenOffice*/program". Where * represents the current
version of OpenOffice. This option is particulary useful when OpenOffice is not on
the C:\ drive.

svy options

osvy data is not svy. No survey characteristics are set

Examples

The following uses the sample data set multistage. To access this dataset and declare
the dataset is survey data use the following code:

.use http://www.stata-press.com/data/r10/multistage

.svyset county [pw=sampwgt], strata(state) fpc(ncounties) || school, fpc(nschools)

Basic Syntax

.tabxml, dv(county) ivd(race) ivc(weight)

In this example, tabxml display a cross tab of county against the discrete
independent variable race and the continuous independent variable weight in that
specific order. Variable labels for independent variables have indentations and
there are lines between each independent variable. The output for the discrete
independent variables is "n (per)", similarily the output for the continuous
independent variable is "mean (SE)". The percents are column percents and "per",
"mean" and "SE" are all rounded to two decimal places. All data is left aligned.
The file is saved as "tab_out.xml". The output is omitted in Stata.

Extensions: options split percent tformat save subcond justify

.tabxml, dv(county) ivd(race) split(sex) save(temp) tf(1) subcond(weight>200) justify(r)

In this example, tabxml display a cross tab of county against the discrete
independent variable race split by sex (female, male and total are the subgroups)
for the sub population where the weight is greater than 200lbs. Variable labels for
independent variables have indentations and there are lines between either side
of the independent variable. The output for the discrete independent variable is
"n (per)". The "per" is rounded to one decimal place. All data is right aligned.
The file is saved as "temp.xml". The output is omitted in Stata.

Extensions: options options order display bold olines otab

.tabxml, dv(county) ivd(race) ivc(weight) split(sex) cond(height>=400) order(weight race) options(n mean nototal) display bold olines otab

In this example, tabxml display a cross tab of county against the continuous
independent variable weight and the discrete independent variable race in that
specific order split by sex (female and male are the subgroups). The dataset is
reduced where race equals one (white). Variable labels for independent variables
do not have indentations and there are no lines between each independent variable.
The independent variable names are bolded. The output for the discrete independent
variables is "n", similarily the output for the continuous independent variable
is "mean". The percents are col percents and "per", "mean" are all rounded to two
decimal place. All data is left aligned. The file is saved as "tab_out.xml".
The output is omitted in Stata.

Extensions: options pval chi2 pdec sp label options excelpath

.tabxml, dv(county) ivd(race) options(per) display pval pdec(3) chi2 sp labrown(sample count=)

In this example, tabxml display a cross tab of county against the discrete
independent variable race. Variable labels for the independent variable have
indentations and there are lines either side of the independent variable. The
independent variable name is not bolded. The output for the discrete independent
variable is "per". The percents are col percents and "per" are rounded to two
decimal places. The percents are followed the % symbol. All data is left aligned.
The file is saved as "tab_out.xml". The independet variable labels are followed
by (sample count=#). The p-val statistic is displayed and rounded to 3 decimal
places. The chi2 statistic is displayed and rounded to 2 decimal places. The output
is displayed in Stata.

Authors

Richard Ryall ARCSHS (Australian Research Centre in Sex, Health and Society)

Email: R.Ryall@latrobe.edu.au

Jason Ferris ARCSHS (Australian Research Centre in Sex, Health and Society)

Email: J.Ferris@latrobe.edu.au