Statalist The Stata Listserver

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

st: Re:mata: how function can return several results

From   Kit Baum <>
Subject   st: Re:mata: how function can return several results
Date   Sun, 15 Oct 2006 07:29:05 -0400

Unlike MATLAB or GAUSS, Mata functions can return any amount of stuff (variables, locals, globals, matrices, scalars) using the st_* commands. See help m4_stata for details. Your bhat could be returned with st_matrix; the easiest way IMHO to return a variable is to create it in Stata and use st_view to modify it in Mata.

ssc type hprescott.ado

gives an example of the latter.

Kit Baum, Boston College Economics
An Introduction to Modern Econometrics Using Stata:

On Oct 15, 2006, at 2:33 AM, statalist-digest wrote:

how can i tell mata to return 2 results
res1=bhat and res2=uhat. res1 and res2 are for use in the rest of my programme.
Ideally I want some thing like this:
{b,u}=myreg() as can i code in gauss for exemple
Abdelrahmen El Lahga
*   For searches and help try:

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