Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Using mkmat with a local as the varlist


From   William Buchanan <[email protected]>
To   [email protected]
Subject   Re: st: Using mkmat with a local as the varlist
Date   Fri, 8 Mar 2013 14:15:31 -0800

Slight correction:

> webuse hsng2
> ivregress 2sls rent pcturban (hsngval = faminc region), small
> ereturn li
> loc instruments `e(insts)'
> di `"`instruments'"'
mkmat `instruments', matrix(B)

Apparently -mkmat- does not like factor variables.


On Mar 8, 2013, at 2:13 PM, William Buchanan <[email protected]> wrote:

> webuse hsng2
> ivregress 2sls rent pcturban (hsngval = faminc i.region), small
> ereturn li
> loc instruments `e(insts)'
> di `"`instruments'"'
> 
> You weren't referencing the _macro_ where the variable names were stored correctly.  
> 
> HTH, 
> Billy
> 
> 
> On Mar 8, 2013, at 2:05 PM, Mauricio Esteban Cuak <[email protected]> wrote:
> 
>> 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/
> 
> 
> *
> *   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/


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index