Dear Roger:
I finally decided to keep -xcontract-. The way the results are presented is nice and very clear to understand (maybe clearer than with a three-way table). I then used -outsheet- to get a tab-delimited file.
Everything is fine then.
Best regards
Herv�
***********************************************************
Professeur/Professor
Coordinateur du D�partement/Head of Department
HEC Paris
D�partement Comptabilit� Contr�le de gestion / Dept of Accounting and Management Control
1, rue de la Liberation
78351 - Jouy-en-Josas
France
Tel: +33 1 39 67 94 42 - Fax: +33 1 39 67 70 86
[email protected]
http://campus.hec.fr/profs/stolowy/perso/home.htm
>>> [email protected] 03/31/05 8:38 PM >>>
You should probably use -xcontract- to create resultssets for each nonempty
subset of the 3 variables, concatenate these resultssets to form a single
long resultsset using -dsconcat- (also downloadable from SSC), sort this
long resultsset by "Formation administrative", "Formation scientifique" and
"Formation de gestion", and then use the official Stata command -reshape
wide- on the resultsset to create a dataset with 1 obs per value of
"Formation administrative" (including a missing value for the totals) and
data on the 9 totals for the 9 combinations of "Formation scientifique" and
"Formation de gestion" (including the totals). This final wide resultsset
can then be output using -outsheet- or -listtex- to produce the generic
spreadsheet you want.
Although Stata does not have a comprehensive table-generating utility like
PROC TABULATE in SAS, Stata can usually create any table as a Stata dataset
(or resultsset) with 1 obs per table row. This can usually be done using
-dsconcat- and/or -reshape-. We can then use -outsheet-, -listtex-,
StatTransfer etc. to reformat this table for delivery to the end user.
I hope this helps.
Roger
At 17:44 31/03/2005, Herve wrote:
>Dear Roger:
>
>I thank you for your help. I used xcontract with the following command:
>
>xcontract form_gestion form_ad form_science if doublon==0 &
>formation_info==1, saving(tab3way.dta, replace)
>
>It works and I get the frequencies for each combination of the three
>variables.
>
>However, I am looking for a method to transfer easily the following table
>obtained with tab3way:
>
>Formation | Formation scientifique and Formation de gestion
>administr | -------- 0 -------- -------- 1 -------- ------ TOTAL ------
>ative | 0 1 TOTAL 0 1 TOTAL 0 1 TOTAL
>----------+------------------------------------------------------------------
> 0 | 51 136 187 155 41 196 206 177 383
> 1 | 111 54 165 35 3 38 146 57 203
> TOTAL | 162 190 352 190 44 234 352 234 586
>
>xcontract provides the content of the above table but not as a three-way
>table.
>
>Nick Cox wrote that there is no method (apart from the awful "cut and
>paste"). So, I fear it's hopeless.
>
>Best regards
>
>Herv�
>
>
>
>
>
>***********************************************************
>Professeur/Professor
>Coordinateur du D�partement/Head of Department
>HEC Paris
>D�partement Comptabilit� Contr�le de gestion / Dept of Accounting and
>Management Control
>1, rue de la Liberation
>78351 - Jouy-en-Josas
>France
>Tel: +33 1 39 67 94 42 - Fax: +33 1 39 67 70 86
>[email protected]
>http://campus.hec.fr/profs/stolowy/perso/home.htm
> >>> [email protected] 03/31/05 5:41 PM >>>
> >Herve STOLOWY wrote:
> >
> > > I use the -tab3way- command to cross-tabulate 3 variables. Do
> > > you know if there is an easy way to get the output in a
> > > tab-delimited format (something equivalent to -tabout- for a
> > > two-way table or -estout- for a regression)?
>
>What you are looking for might be -xcontract- (downloadable from SSC),
>which can produce output Stata datasets with 1 obs per combination of
>variable values (from 1, 2, 3, 4 or more variables) and data on frequencies
>and/or percentages. The output datasets (or resultssets) may be listed,
>written to a disk file, or written to memory, overwriting the pre-existing
>data. The resultsset can be converted to tab-delimited form by the official
>Stata -outsheet- command, or converted to tab-delimited or
>ampersand-delimited or HTML or TeX form by -listtex- (also downloadable
>from SSC).
>
>I hope this helps.
>
>Roger
>
>
>
>--
>Roger Newson
>Lecturer in Medical Statistics
>Department of Public Health Sciences
>Division of Asthma, Allergy and Lung Biology
>King's College London
>
>5th Floor, Capital House
>42 Weston Street
>London SE1 3QD
>United Kingdom
>
>Tel: 020 7848 6648 International +44 20 7848 6648
>Fax: 020 7848 6620 International +44 20 7848 6620
> or 020 7848 6605 International +44 20 7848 6605
>Email: [email protected]
>Website: http://phs.kcl.ac.uk/rogernewson/
>
>Opinions expressed are those of the author, not the institution.
--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
Division of Asthma, Allergy and Lung Biology
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom
Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Website: http://phs.kcl.ac.uk/rogernewson/
Opinions expressed are those of the author, not the institution.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/