Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
Neil Shephard <nshephard@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: How can I append tabout output in Excel using logout? |

Date |
Wed, 28 Apr 2010 10:39:26 +0000 |

I don't really use Excel (other than to save data I've been sent to CSV for importing into Stata) or use M$-Windows, but I suspect that because of the proprietary nature of the Excel file format that -logout- is actually writing CSV files and files with the .csv extension are (generally) associated with the Excel program on most M$ machines. If you _really_ want to do this (-collapse- and -statsby- will likely get you there quicker though), then you can write lots of individual files (with a slight tweaking of your code) and then concatenate them into one large file. You can even do this from within Stata by making a shell call. >> >> forv i=0/5 { >> foreach y in male singlet{ >> forv s=0/1{ >> di "myga==`i' & `y'==`s'" >> qui su bwtg if myga==`i' & intab1==1 & admit_ic==1 & bwtg<. & `y' >> if r(N)!=0{ >> logout, save("C:\data\do_files\mytab_`i'_`y'_`s'.txt") excel replace: tabstat >> bwtg if myga==`i' & intab1==1 & admit_ic==1 & bwtg<., stat(n mean >> median p25 p75 min max ) by(`y') col(stat) f(%9.0g) notot nosep >> >> } >> } >> } >> } * Note that I've modified the above code so that each call to -logout- is writing the results to an individual file based on levels of i, y and s * Under a UNIX-like system the command to use is 'cat' and whilst you'd never have a "c:\" path the call would be !cat c:/data/do_files/mytab_* > c:/data/do_files/mytab.txt * Under M$-Windows you need to use the DOS Copy command (see http://support.microsoft.com/kb/69575) !COPY c:/data/do_files/mytab_* c:/data/do_files/mytab.txt Should do the trick, but as Nick says what is it that you can't do in Stata? Neil -- "... no scientific worker has a fixed level of significance at which from year to year, and in all circumstances, he rejects hypotheses; he rather gives his mind to each particular case in the light of his evidence and his ideas." - Sir Ronald A. Fisher (1956) Email - nshephard@gmail.com Website - http://slack.ser.man.ac.uk/ Photos - http://www.flickr.com/photos/slackline/ * * 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/

**Follow-Ups**:**Re: st: RE: How can I append tabout output in Excel using logout?***From:*sara khan <sarakhanum84@googlemail.com>

**References**:**st: How can I append tabout output in Excel using logout?***From:*sara khan <sarakhanum84@googlemail.com>

**st: RE: How can I append tabout output in Excel using logout?***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: RE: How can I append tabout output in Excel using logout?***From:*sara khan <sarakhanum84@googlemail.com>

- Prev by Date:
**Re: st: RE: How can I append tabout output in Excel using logout?** - Next by Date:
**Re: st: RE: How can I append tabout output in Excel using logout?** - Previous by thread:
**Re: st: RE: How can I append tabout output in Excel using logout?** - Next by thread:
**Re: st: RE: How can I append tabout output in Excel using logout?** - Index(es):