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

Re: st: Copying data from stata's editor to excel.


From   adiallo5@worldbank.org
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Copying data from stata's editor to excel.
Date   Thu, 10 Nov 2005 15:16:35 -0500

All solutions worked perfect.
Actually, I have tried format but
issued the wrong command
(%9.0g...). This suggests I must
learn more about format (:-)).
Many thanks.
Amadou.


------------------------------------------
                                                                                 
                                                                                 
                                                                                 
 Just an example to show the nature of the problem.                              
                                                                                 
 Run this code on an empty dataset                                               
 ********* CODE *********                                                        
                                                                                 
 input x                                                                         
 1000                                                                            
 1.123456                                                                        
 987654321                                                                       
 3002001000                                                                      
 end                                                                             
                                                                                 
 browse                                                                          
 * Copy to excel. Numbers are wrong.                                             
                                                                                 
 format %12.0g _all                                                              
 browse                                                                          
 * Copy to excel. Numbers are ok now                                             
                                                                                 
 ********* END *********                                                         
                                                                                 
 As previous posts have said, formatting the data fixes the problem.             
                                                                                 
 Sergio                                                                          
                                                                                 
 On 11/10/05, Ronnie Babigumira <ronnie.babigumira@umb.no> wrote:                
 > Amadou                                                                        
 > In addition to the comments others have made, here is what I do when          
 I work=                                                                         
 >   with excel                                                                  
 >                                                                               
 > 1. Typically I have results saved as a textfile (usually a matrix). I         
 then =                                                                          
 > use excel's import wizard. The key here is that I make sure that all          
 column=                                                                         
 > s are imported as text. That way I am sure excel does not try to              
 round off-=                                                                     
 > up- or-away stuff for me.                                                     
 >                                                                               
 > 2. For the occasional cut and paste job, I copy (use table option)            
 and afte=                                                                       
 > r the initial pasting, a small box appears at the bottom of the               
 pasted stuf=                                                                    
 > f. This little guy offers some paste options and once again I use the         
 text =                                                                          
 > import wizard, you then get the option of specifying the text option          
 for st=                                                                         
 > uff you dont want excel to mess with.                                         
 >                                                                               
 > Ronnie                                                                        
 >                                                                               
 > Ronnie Babigumira                                                             
 > Dept. of Economics and Resource Management                                    
 > Norwegian University of Life Sciences (UMB)                                   
 > PO Box 5003,                                                                  
 > N-1432 =C5s,                                                                  
 > Norway                                                                        
 >                                                                               
 > >>> adiallo5@worldbank.org 11/09/05 10:31 pm >>>                              
 > Hi,                                                                           
 > I am sure this has been already discussed, but how to                         
 > get exact values when coping data from Stata's editor                         
 > to Excel?                                                                     
 > Excel keeps rouding results and I want to avoid that (for                     
 > example 989958 in stata is rounded to 990000 in excel).                       
 > When applying mata's function varsum in Stata, I get different                
 > result on the total with what is given by Excel.                              
 > Best regards.                                                                 
 > Amadou.                                                                       
 > *                                                                             
 > *   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/                                       
 >                                                                               
                                                                                 
 *                                                                               
 *   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/



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