On Apr 17, 2004, at 2:33 AM, Renzo wrote:
I would like to do the following thing
. local macroname = var1 if var2==value
This is not legal syntax though. I looked on [U] and [P] to see if
there
were any extended macro function to help me but I did not find any.
You are confusing the 'if' that may appear as a component of many Stata
commands, e.g. summarize income if sex==1, and the programmer's 'if'.
Furthermore, since each observation of var2 may take on a different
value, what does it mean to generate one macro with value equalling the
first observation of var1 in this context? Do you mean if any
observation of var2 takes on 'value'? Or if all observations of var2
are equal to 'value'?
Your workaround looks only at the first observation of var2. Is that
what you really mean? Please clarify.
Kit
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/