<>
You are welcome, as always. Similar issues have cropped up before:
http://www.stata.com/statalist/archive/2009-08/msg00134.html
[U], 18.3.3 could be for you to delve into this issue.
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Tomas Lind
Gesendet: Freitag, 22. Januar 2010 16:56
An: statalist@hsphsun2.harvard.edu
Betreff: st: SV: RE: RE: locals have short memory
I see.
Many thanks Nick and Martin for your help and expertise.
/Tomas
-----Ursprungligt meddelande-----
Från: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] För Nick Cox
Skickat: den 22 januari 2010 16:49
Till: statalist@hsphsun2.harvard.edu
Ämne: st: RE: RE: locals have short memory
By the way, the issue is not shortness or length of memory. Stata will
remember the locals indefinitely in a session that never stops, so long as
they are not destroyed or overwritten.
The issue is that "locals" are precisely that, locals within a program
space: an interactive session, a do-file, do-file editor contents, and any
and all spaces within which a -program- is working are all quite separate
spaces.
Nick
n.j.cox@durham.ac.uk
-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Short answer is No.
You need either globals or to map from one set of locals in one space to
another set in another space.
The latter can be done but is best avoided until you understand this point.
Nick
n.j.cox@durham.ac.uk
-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Tomas Lind
Sent: 22 January 2010 15:30
To: statalist@hsphsun2.harvard.edu
Subject: st: locals have short memory
Hi all,
The syntax below works fine if I highlite all rows and click on run". Is
this what is called "a Stata session"? However, immediately after that,
Stata forgets the content of the local macros. Is it possible to make the
the local macros functioning until I close down Stata.
/Tomas
local mynames "Stockholm Uppsala Södermanland Kronoberg"
token `mynames'
local mycount: word count `mynames'
forv i=1/`mycount' {
local lannr = `i' + 21
di " "
di " "
di in r "``i''"
}
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/