Statalist


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

st: exporting decimal place format styles


From   "Jason Ferris" <[email protected]>
To   <[email protected]>
Subject   st: exporting decimal place format styles
Date   Mon, 27 Oct 2008 10:51:42 +1100

Thanks for your response Sergiy,
I am aware of XML_TAB but I do believe it doesn't allow adjustments for survey data; which I am using.  I guess I would like to know who the XML_TAB.ado file operates to 'tell' Excel to use a particular decimal place value. If not, if someone know a way to do this so I can use the code in my syntax.

Jase


From
  "Sergiy Radyakin" <[email protected]>
To
  [email protected]
Subject
  Re: st: exporting decimal place format styles
Date
  Wed, 22 Oct 2008 15:48:07 -0400
________________________________________
Hello Jason,

I'd suggest you to use XML_TAB. It's approach is unique in that sense
that it exports exact values (with 10-12 whatever digits after comma)
and tells Excel how many digits to display , so it truly sets the
_format_ in the cell, rather than rounds up the numbers to appear as
if they were formatted. The exact values are further available for
computations in Excel, and if later you decide you need couple of more
digits in your table - that's easy to fix right in Excel.

You can export both regression estimates and free-form tables
(matrices) with XML_TAB.

You can specify, how many digits you want to keep in your output by
specifying option format(flist) where elements of flist are of the
form: N2203 - numeric, horiz alignment center, vert alignment center,
regular font, 3 decimal digits

Best regards, Sergiy Radyakin


On Wed, Oct 22, 2008 at 1:58 AM, Jason Ferris <[email protected]> wrote:
> 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


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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index