Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Best way to export a simple Stata model

From   daniel klein <>
Subject   Re: st: Best way to export a simple Stata model
Date   Sun, 12 Feb 2012 11:00:27 +0100


as you say -mat2txt- and -mat2csv- are user-written programms and you
are asked to explain where they come from. It seems  -mat2txt-
(Blasnik, Jann) is from the SSC archieves. However -findit mat2csv-
returns no results so I cannot say what it is and where it is from.

Regarding the syntax you showed, you will have to put matrix M where
Stata can find it as -mat2txt- will not be able to export a matrix
from Mata. You do this typing

mata : st_matrix("M", M)

followed by

mat2txt  [...]


I need to export a matrix from mata to a csv or text file.
Suppose I do the following:

sysuse auto;
putmata X = (1 mpg);
M = invsym(X'*X);

Is there a way to make M symmetric and export it? I tried using
user-written mat2txt and mat2csv, but I am getting the following
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index