Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Easy way to export Stata output to Excel versions with different decimal separator

From   Finne Håkon <>
To   "''" <>
Subject   st: RE: Easy way to export Stata output to Excel versions with different decimal separator
Date   Fri, 16 May 2003 09:45:50 +0200

Stefan's solution is useful for many paste inputs to Excel, not just from

There are other approaches, too. One is built on the understanding that for
MS Excel and many other Windows programs, it is a setting in your copy of
Windows that takes care of the decimal symbol. You can easily change this
setting back and forth between "." and "," -- and Excel will change its
display accordingly. If your Stata displays "." for decimal symbol, change
the Windows setting to display "." for decimal symbol, then Copy Table from
Stata, Paste into Excel. Now (or later) you may change the Windows setting
back to "," for decimal symbol if you like, and presto! -- the display in
Excel is the way you like it.

The Windows setting in question is found (in many versions of Windows) under
Start -> Control panel -> Regional options -> Numbers (or equivalent in
non-English translations). Make sure that both the symbol for decimal point
and the symbol for thousands separator are set in line with Stata output
when you are coing to paste from Stata.

If you don't want to change the Windows setting, you can also change the way
Stata (at least version 7) displays the decimal point. The command is -set
dp comma- or -set dp period- . This only changes the display in the Stata
results window, but that might be sufficient for your purpose.  Then Copy
table and Paste directly into Excel without changing the European default
Windows setting.

As an exercise for those with a US Windows version, issue -set dp comma- in
Stata and see how you can talk Windows into accepting output from the Stata
results window.

It is a bit more intriguing that Stefan should get Stata numbers transformed
into Excel dates but the key probably lies in the Regional options for Date
(and possibly Time). Excel also provides formatting options on its own that
may convert inputs like 2.3 to March 2nd and other surprising effects. Look
up Help for the Format topic in Excel.

-- Håkon

-----Original Message-----
From: Dr. Gawrich, Stefan []
Sent: 15. mai 2003 16:24
To: ''
Subject: st: Easy way to export Stata output to Excel versions with
different decimal separator

I often have to copy Stata-Output (mostly tables) into Excel. 
The german Excel version uses (like in many other european countries) the
"," as decimal separator instead of the ".". 
Using "Copy-Table" and "Paste" I get errors (e.g. automatic transformation
of numbers into dates) so I always have to do some editing tricks to get it
In Stata related help stuff I didn't find Information on this problem. 
In Excel support pages and newsgroups the most given suggestion is to change
country preferences (which would affect all Software on the user account)
But at last I found an easier solution, hope it is useful for some of you: 

In Stata mark the output and just copy (STRG-C), not Copy Table 
Paste into Excel. The column which contains the whole copied data must be
Menu DATA -> Text to Columns 
Normally "Fixed Width" will do for Stata Tables -> Next 
Adjust columns if necessary  -> Next 
Now the most important part: Click "Advanced" and choose the decimal
seperator (in the case of Stata output ".")  -> O.K. -> Finish
Thats it. 

Stefan Gawrich 

*   For searches and help try:

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