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 contents.
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 "
or
local str " a b c"
-- and they rarely complicate things, but in many instances
they are at choice.
Nick
[email protected]
Friedrich Huebler
> 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:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/