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

st: Re: output of matrix to tab-delimited format


From   baum <[email protected]>
To   [email protected]
Subject   st: Re: output of matrix to tab-delimited format
Date   Wed, 14 Aug 2002 08:20:46 -0400

--On Wednesday, August 14, 2002 2:33 -0400 Chris wrote:

I have a do file which produces a matrix that looks like the following:

. matrix list cruderates

cruderates[16,2]
          year  cruderate
 r1       1985   81.92156
 r2       1986  98.751156
 r3       1987  82.547712
 r4       1988  82.952468
 r5       1989  80.970742
 r6       1990  81.062824
 r7       1991  71.783296
 r8       1992  71.620412
 r9       1993  75.797872
r10       1994  71.224445
r11       1995  71.755725
r12       1996  68.763557
r13       1997  67.719602
r14       1998  68.801385
r15       1999   67.62559
r16       2000  64.357494

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.

svmat cruderates,names(matcol)
outsheet cruderates* in 1/16 using cruderates

This will create a tab-delimited file named cruderates.out which can be read into Excel. The column headings will be 'cruderatesyear, cruderatescruderate'. It might be best to make a copy of the matrix with a shorter name. The matcol option is used to avoid overwriting any variables in the existing data space.

Kit



*
* 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