Statalist The Stata Listserver


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

st: How to convert matrix to variables in MATA


From   Bamidele Tayo <[email protected]>
To   [email protected]
Subject   st: How to convert matrix to variables in MATA
Date   Mon, 11 Dec 2006 15:57:01 -0800 (PST)

Dear Stata Users,

I am using Stata 9.2 and I would appreciate if someone can help me
with how to convert matrix to variables in MATA. What I want to do is
(i) read some values from stata file into column vector "D1", (ii)
convert column vector "D1" to a symmetric matrix "D2", (iii) convert
matrix "D2" to column vector "D3", and (iv) save "D3" to either
existing/new stata file or ASCII file. Steps (i) - (iii) work well,
but I can get to accomplish step (iv) with any of the commands in the
MATA manual. Perhaps, what I want is how to perform the same task
that "savmat" command does in the old matrix language of Stata. Below
are the codes I am using.

log using "c:\test1.log", replace
use "C:\test1.dta", clear
mata
D1 = st_data((1,6),"wt")
D2 =invvech(D1)
D3 =vec(D2)
D1
D2
D3
/* want to save D3 to an ASCII or Stata file here */
end
log close

Thanks in advance for your help.

Bamidele Tayo


 
____________________________________________________________________________________
Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com
*
*   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