Statalist


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

st: AW: local macro dereferencing


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: local macro dereferencing
Date   Mon, 10 Aug 2009 16:58:42 +0200

<> 


A good place to start would probably be
http://www.stata-journal.com/article.html?article=pr0040




HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Nelson, Carl
Gesendet: Montag, 10. August 2009 16:38
An: [email protected]
Betreff: st: local macro dereferencing

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:
	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:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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