variables - Stata - When are global macros deleted? -
variables - Stata - When are global macros deleted? -
i have file select few lines of code , run them using execute (do)
button. problem there bunch of local macros defined in file. can run them, in stata command prompt local macros not accessible. thus, think should using global macros.
i have looked in several places , haven't been able find out scope macro variables have. realize local macros defined in instance (eg. file) created in. global macros, stored forever , every time open new instance of stata still have global macros previous sessions? or deleted each time exit out of stata (or else)?
global means visible everywhere, not time.
global macros create disappear @ end of session.
when start session, or indeed @ time, macro list
shows global , local macros visible within current locale. here "locale" not word used in stata documentation, nonce coinage denote current interactive session, current program, current contents of do-file editor or selection thereof, namely code running. difference local macros visible within locale in defined; global macros visible in locale.
some global macros appear created on fly; if wish display of current date or time can
di "$s_date" di "$s_time"
and stata access operating scheme such details.
but easiest way reply question experiment. define global such
global whoami "bill999" di "$whoami"
and sign off , start new session , see whether saved stata. alternatively, save
current dataset , use
same dataset in new session , see whether globals survive journey.
see help notes
.
variables macros global local stata
Comments
Post a Comment