Statalist The Stata Listserver

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

[no subject]

real matrix   st_matrix(string scalar name)
string matrix st_matrixrowstripe(string scalar name)
string matrix st_matrixcolstripe(string scalar name)

void          st_matrix(string scalar name, real matrix X)
void          st_matrixrowstripe(string scalar name, string matrix s)
void          st_matrixcolstripe(string scalar name, string matrix s)
void          st_replacematrix(string scalar name, real matrix X)

But you can also go directly from a Mata matrix to a Stata data set.

Use the st_store() function, e.g. in a do file like this:


void function StoreData(real matrix X)
    real rowvector varidx
    varidx = st_addvar("double", st_tempname(cols(X)))



qui describe
local nvars = `r(k)'
unab varlist: _all
local count 1
foreach var of local varlist {
    rename `var' var`count++'



Kind regards,

Jesper Kjr Hansen
Student Assistant
Department of Statistics
University of Southern Denmark

*   For searches and help try:

© Copyright 1996–2020 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index