Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: global query


From   "Ingo Brooks" <[email protected]>
To   [email protected]
Subject   Re: st: global query
Date   Thu, 19 Apr 2007 16:23:05 +0200

Sebastian,

Thanks a lot for your answer, this is exactly what I needed.

Best,
Ingo


On 4/19/07, Sebastian F. B�chte <[email protected]> wrote:
Ingo,

using brackets will help to solve your issue

global test "Just a "

di "${test}test!"

Using brackets enable you to tell Stata were the global macro's name
ends since a global macro's content is access by just adding the
$-sign at the beginning of its name.

Regards
Sebastian


On 4/19/07, Ingo Brooks <[email protected]> wrote:
> Dear all,
>
> I have a problem using global macros:
>
> . local Test "aut"
> . sysuse `Test'o , clear
>
> works fine and opens the auto.dta dataset. However,
>
> . global Test "aut"
> . sysuse $Testo , clear
>
> gives the following error message:
>
> invalid file specification
> r(198);
>
> I know that I could solve the problem at hand by introducing a local
> macro as follows:
>
> . global Test "aut"
> . local Test "$Test"
> . sysuse `Test'o , clear
>
> Unfortunately, however, this is quite cumbersome and there are lots of
> macros in my do-files which all begin with the same first part (in the
> example above: "aut") but whose second part changes (the "o" in
> "auto"). I need to use global macros because I have to exchange
> information between several do-files and therefore cannot rely on
> local macros.
>
> Any help would be appreciated.
>
> Best,
> Ingo
> *
> *   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/
>
*
*   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/

*
*   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/



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