[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: Problem with macro: -twoway scatter- type mismatch
This is indeed still legal Stata. When a macro
acquires contents by copying, then the syntax is
local <macname> <contents>
so that whatever follows the macro name becomes
The quotes " ", on occasion `" "', have two purposes:
to indicate to Stata where a string begins and ends;
and to emphasise to the reader of your code -- even
if only yourself, that usually includes yourself at a
later date -- that a certain string is being inserted
into the macro. Thus, for example,
local str "a b c"
is arguably a smidgen easier for even very experienced
Stata programmers to absorb mentally than
local str a b c
Sometimes that second purpose is as or more important
than the first purpose, because the meaning to Stata
is, at least in terms of result, the same in both cases.
Quotes can be essential in some problems, as when you
want leading or trailing spaces, as in
local str "a b c "
local str " a b c"
-- and they rarely complicate things, but in many instances
they are at choice.
> Thank you, Ben and Seb. I went through my code, removed several quote
> marks and can now make a graph with -twoway `scatter'-. I had assumed
> that string macros must be enclosed in quotes, like this:
> . local str "a b c"
> In the code that runs without error message, I create the string
> macros without quote marks.
> . local str a b c
> Is this still official Stata? All examples in [P] macro use quotes
> around the strings.
* For searches and help try: