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 on April 23, and its replacement, 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 <>
Subject   st: Using mkmat with a local as the varlist
Date   Fri, 8 Mar 2013 16:05:50 -0600


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,

*   For searches and help try:

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