[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: Output to Excel
I believe the command that David is referring to that converts a matrix into
variables is -svmat-, which is part of official Stata. With the matrix
converted to variables, -outsheet- should then work nicely.
> -----Original Message-----
> From: David Kantor [SMTP:email@example.com]
> Sent: Tuesday, August 13, 2002 10:22 AM
> To: firstname.lastname@example.org
> Subject: Re: st: Output to Excel
> At 11:09 AM 8/13/2002 +0000, Christopher D Fergusson wrote:
> >Hello statalisters,
> >I have a do file which produces a matrix that looks like the following:
> >. matrix list cruderates
> > year cruderate
> > r1 1985 81.92156
> > r2 1986 98.751156
> >I need to send this matrix to excel and would like the do-file to do this
> >automatically. Would this be possible? I have looked at the
> >possibilities of using outfile and outsheet but am not sure if these will
> >be of any use as they seem to read the dataset, not the matrix.
> Several possibilities:
> (1) You could list the matrix in a log; snip out that segment of the log
> and then have excel read it. But those latter steps would be manual.
> (2) There is some Stata program that brings a matrix into a data set (and
> maybe another one that goes the other way). Sorry, I don't recall what
> that is and whether it is part of standard Stata. I believe that Nick Cox
> wrote it. You should be able to find it.
> (In doing this, you may want to first -preserve- the existing data set, so
> you can get it back afterwards -- unless this is built into that
> Once you have it in a data set, save it. Then invoke StatTrasfer to
> convert it to Excel. StatTrasfer is a separate program from an
> provider. (See www.stattransfer.com; it's also mentioned in the Stata
> manuals. If you work for an educational institution, you may be able to
> it cheaply through your institution.) You should use its
> mode, NOT its menu system. Then you can invoke the StatTransfer commands
> (in a .stc file.) via a shell command in your Stata do-file.
> (You could, alternatively, use -outsheet-. But then, again, you need to
> invoke Excel and go through the manual steps of reading in the file --
> unless there is some way of scripting the Excel commands; I don't know if
> there is.)
> All of this requires a lot of set-up work. Presumably you want to do it
> repeatedly many times, and so it will be worthwhile. Otherwise, if you
> doing it just a few times, the first method is easier.
> I hope this helps.
> David Kantor
> Institute for Policy Studies
> Johns Hopkins University
> * 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: