Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Copy table--how to consistently get correct tab stops


From   "Sergiy Radyakin" <[email protected]>
To   <[email protected]>
Subject   Re: st: Copy table--how to consistently get correct tab stops
Date   Fri, 6 Jul 2007 14:40:21 -0400

to insert a TAB into output use `=char(9)':
e.g.:
display "Alpha`=char(9)'Omega"

See ASCII tables for other non-printable codes (first 32 codes)

To export to office applications create a matrix holding the table you want to export and use -xml_tab- to output it to EXCEL.

Best regards, Sergiy





----- Original Message ----- From: "David Radwin" <[email protected]>
To: <[email protected]>
Sent: Friday, July 06, 2007 2:06 PM
Subject: RE: st: Copy table--how to consistently get correct tab stops



I respectfully disagree with Tim on SPSS v. Stata on this matter. I used to use SPSS a good deal and still do occasionally, and while Stata is superior in almost every way, in my opinion SPSS is better able to create tables that are simple to copy and paste into Excel or Word for further formatting.

While Tim's technique of inserting text like "zzz" or converting paragraph marks to tabs might work to copy Stata tables, it still requires extra steps in Word or Excel that are not necessary with SPSS. To demonstrate what I mean, below are links to two files containing the crosstabulation of mpg by rep78 that I used as an example earlier. In each file, the first table was pasted from Stata 9.2 and the second was pasted from SPSS 11.0. The key difference is that in both Excel and Word, the SPSS table pasted correctly with no additional formatting while the Stata table incorrectly added an extra column. The SPSS table also has the nice feature of not breaking up the headings into two lines.

https://webfiles.berkeley.edu/~radwin/Copy_table_to_Excel.xls

https://webfiles.berkeley.edu/~radwin/Copy_table_to_Word.doc

In my line of work (university administration), Excel and Word are the standard for creating and sharing data analysis (although these analyses are often converted to Powerpoint or PDF for the latter purpose). Pasting tables quickly, efficiently, and accurately into these programs is far more important than, say, providing correct standard errors for multinomial logit for a survey with multistage sampling.

In fact, copying tables is the main issue that prevents me from universally recommending Stata to my colleagues (as opposed to SPSS, SAS, or nothing at all). I wish this were possible from the standard -tabulate- commands, because most of my colleagues are not interested in learning -display- or -tabout- to get a properly formatted table into Word or Excel when they could do so more easily in SPSS.

David

At 9:47 AM +0100 7/6/07, Mak, Timothy wrote:

I don't use SAS so I cannot comment on SAS, but I have to say Stata is
far far more flexible in its output of nicely formatted tables than SPSS
can ever be. I don't use the Copy Table function, but what I do is I use
the -display- function to get the stats in exactly the format I want. Ok
I don't know how to generate a 'tab' in Stata, but instead of tab, I can
generate a funny piece of string, say "zzz" or something, and use copy
text in Stata to paste the whole thing in Word. Use Find/Replace to
change all the "zzz" to tabs, then use Convert text to table in Word.
Voila. Done! No need to fix up decimal places, change the order of the
stats, etc. Output is always consistent as long as you type your
-display- function the same way. Down side is, of course you need to
learn to write the -display- command, but the time saved will soon make
it worthwhile.

Tim

PS An even quicker way is to use paragraph marks instead of tabs, and
then just use Convert text to table in Word, and adjust the number of
columns.

--
David Radwin, Principal Analyst // [email protected]
Office of Student Research, University of California, Berkeley
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index