Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: macro multiplication

From   "Nick Cox" <>
To   <>
Subject   st: RE: macro multiplication
Date   Mon, 28 Nov 2005 23:04:04 -0000

You cannot have it both ways. Given that 


is global, you need to refer to it accordingly. 

global mua = -1
local na = 1
local mpa = $mua * `na'

BTW, code is often easier to read with spaces
on either side of most operators and equals signs. 


Daniel Egan
> I am baffled by something I just encountered. Then again, i haven't
> been using Stata for 2 months, so its possible I am just still
> thinking in another language.
> I am writing what amounts to a simulation in stata, mostly using only
> globals and macros. When I try to multiply two macros, I get a
> "invalid name" error.
> The relevant code is:
> global mua=-1
> local na=1
> local mpa=`mua' *`na'
> Sorry if this is obvious. I did search help/archives.

*   For searches and help try:

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