Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: Using mkmat with a local as the varlist


From   Mauricio Esteban Cuak <cuak2000@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Using mkmat with a local as the varlist
Date   Fri, 8 Mar 2013 16:05:50 -0600

Hi,

I'm trying to save the lists of variables from a macro as an argument
for the mkmat command.
Here is an example of the use I'm trying to give:

******** Begin Code**************

sysuse auto, replace

foreach v of var * {
	drop if missing(`v')
}

qui ivregress gmm price trunk (weight = turn length )

/*  Now i'd like to construct a matrix with the instruments      */

/* This works: */

mkmat trunk turn length, matrix(A)

/* But this doesn't:  */

local instruments e(insts)

mkmat `instruments', matrix(B)


***** End of code ********

I've tried different ways to define the local but I haven't been able
to make it work. I think the problem is mkmat takes `instruments' as a
string and not as
a list of variables, but I don't know how to fix it...

Thanks for your time,

M.C.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index