Statalist The Stata Listserver

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

Re: st: RE: Saving global variables for future Stata sessions

From   Rachel <>
Subject   Re: st: RE: Saving global variables for future Stata sessions
Date   Wed, 14 Feb 2007 12:41:02 -0500

Nick and David,

Thank you for pointing me to the file.  The only issue is
that I add definitions from session to session, so I need to
continually update this file.

One way to copy the macro definitions from the command log file and
paste them into the file each time.

Is there some elegant way to keep  the macro definition commands in a
separate log file?  If Stata can't do this, is there a text editor you
know of that can automatically delete lines that don't begin with
"global" (or local, etc.)?

Thanks very much,

On 2/14/07, Nick Cox <> wrote:
Communication is easier if you follow Stata's
terminology. By "global variable" I guess you
mean "global macro".

If you want to save global macro contents with
datasets I believe that you must do it indirectly.

You mention .do files. A variant on that is to
add global definitions to your file,
or to have a file

global foobar "foobar"
global buzz "fuzz"
global answer = 42

and then to have within
a command

do myglobal

Alternatively, save a global as a characteristic (good),
or in a variable (poor style, but may be practical).



> Is there any program or built-in command that can do this. I'm looking
> for some way other than simply saving the macro declarations as a do
> file and running them each time I open a new session.

*   For searches and help try:

*   For searches and help try:

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