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, **statalist.org** is already up and running.

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

From |
Daniel Borowczyk Martins <stata.danielbm@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: using macros in -gmm- |

Date |
Wed, 10 Aug 2011 12:38:35 +0100 |

Dear stata users, I am unable to male use of macros with the -gmm- stata command. Here's an example. 1. Take a cross section data set with variables y and x. 2. I want to estimate an IV regression on the model "y constant x" 3. x is endogenous. 4. I use lags of x to instrument it. I define the first and last lags of the instrument set as two macros. local first = 1 local last = 3 gmm (y - {b0} - {b1}*x1), instruments(l(`first'/`last').x1) I get the following error "l(`first'/`last') numlist in operator invalid" I tried with scalar rather than local and the same problem arises. However, typing gmm (y - {b0} - {b1}x1), instruments(l(1/3).x1) works fine. Now, if I define x1 as a local, we can see that -gmm- doesn't "read" macros. local regressor "x1" gmm (y - {b0} - {b1}*x1), instruments(l(1/3).`regressor') I get the following message "Model not identified. There are more parameters than instruments". Is there anyway to circumvent this problem? I want to embed estimations using -gmm- in a dofile that works with several locals.... Thanks in advance. Daniel * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: using macros in -gmm-***From:*Scott Merryman <scott.merryman@gmail.com>

- Prev by Date:
**st: Mata and do files** - Next by Date:
**Re: st: Mata and do files** - Previous by thread:
**st: Mata and do files** - Next by thread:
**Re: st: using macros in -gmm-** - Index(es):