See
http://www.stata.com/statalist/archive/2006-06/msg00306.html
ben
> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of U.A.QU.AP
> Sent: Sunday, October 15, 2006 3:03 AM
> To: [email protected]
> Subject: st: mata: how function can return several results
>
> I would like to write a subroutine in mata that can return a several
> result a once. More precisely if I define a function (myreg for
exemple )
> defined as
> -------------start myreg
> function myreg () {
>
> st_view(y, ., st_local("yvar"))
> st_view(x, ., st_local("xvar"))
> bhat=invsym(x'*x)x'*y // estimated coefficient
> uhat=y-x*bhat // residual
> }
> ----------- finish myreg
> 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:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
*
* 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/