Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: exporting decimal place format styles


From   "Jason Ferris" <J.Ferris@latrobe.edu.au>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: exporting decimal place format styles
Date   Wed, 22 Oct 2008 16:58:36 +1100

I am using a number of the *.ado files created by all the brilliant
users out there (mat2txt, tabout, estout) to create *.xls or *.OOo
files.  However, when I use any of these *.ado files I keep having the
same problem: the number of decimal places change depending on the
status of the last digit(s) when I import into Excel.

For example if I do the following:
tabout rep78 foreign using trial.xls, replace f(3) cell(col) /* to have
3 decimal places in the output */

I get the following results in excel:
	Car type		
Repair Record 1978	Domestic	Foreign	Total
	%	%	%
1	4.167	0	2.899
2	16.667	0	11.594
3	56.25	14.286	43.478
4	18.75	42.857	26.087
5	4.167	42.857	15.942
Total	100	100	100

As you can see when excel opens this - the default column settings of
excel convert 56.250 to 56.25 (similarly for 18.75)

Now I recently noticed that the xml_tab.ado overcomes this issue.  But I
am unable to decipher where in the code the decimal place format tells
Excel to use a particular setting (in the case of xml_tab I believe it
has to do with making excel custom format of type #,###0.000)

I need to control the format structure from Stata and not from within
Excel.

I would appreciate any insight.

Cheers,
Jase

Jason Ferris, BPsych(Hons) MBiostat GStat
Research Fellow
Australian Research Centre in Sex, Health and Society
La Trobe University
215 Franklin St
Melbourne VIC 3000
P: 61 (0)3 9285 5282
F: 61 (0)3 9285 5220


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index