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

st: local macro dereferencing

From   "Nelson, Carl" <>
To   "" <>
Subject   st: local macro dereferencing
Date   Mon, 10 Aug 2009 09:37:53 -0500

I am trying to use a local macro for a long variable list but it appears that it is not being dereferenced.
It is created with

local x1var age_m age_f incearn_m incearn_f black hispan_m healfpm healfpf slfemp_m /*
*/ incretir_m incretir_f incgovt_m incgovt_f yrswk_m yrswk_f educ_m educ_f /*
*/ wltagem wlt2agem wltagef wlat2agef wlteincm wlt2eincm wlteincf wlt2eincf /*
*/ wltblack wlt2black wlthispan wlt2hispan wlthealthm wlt2healthm wlthealthf wlt2healthf /*
*/ wltselfm wlt2selfm wltrincm wlt2rincm wltrincf wlt2rincf wltgincm wlt2gincm wltgincf wlt2gincf /*
*/ wltyrswm wlt2yrswm wltyrswf wlt2yrswf wlteducm wlt2educm wlteducf wlt2educf

macro list returns the correct contents of _x1var. The macro is then used in the following statement

mata: gmmrsk("share_riskyassets_broad","risktol_m risktol_f","wlt wlt2","`x1var'") where the mata program was defined as

	mata set matastrict on
	void gmmrsk(string scalar yname, string scalar hname, ///
	string scalar x2name, string scalar x1name)

execution of the mata command returns

 -------------------------------------------------------------------- begin gmmbarg ---
      - mata: gmmrsk("share_riskyassets_broad","risktol_m risktol_f","wlt wlt2","`x1var'")
      = mata: gmmrsk("share_riskyassets_broad","risktol_m risktol_f","wlt wlt2","")
varlist required
               st_data():  3598  Stata returned error
                gmmrsk():     -  function returned error
                 <istmt>:     -  function returned error

It appears to me that x1var is not being dereferenced, but I don't understand why. What is my syntax error?

Carl Nelson

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index