Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Martin Weiss" <martin.weiss1@gmx.de> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: RE: Re: Declaring several local variables at once |
Date | Thu, 5 Aug 2010 20:11:13 +0200 |
<> You can loop over names, if you really want to: *********** foreach name in a b c d e f g{ loc `name' 0 } *let`s see ma di _a _b _c _d _e _f _g *********** HTH Martin -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Dani Tilley Sent: Donnerstag, 5. August 2010 20:06 To: stata Subject: st: Re: Declaring several local variables at once Thanks for your reply. So, is there a way to declare them in one line that avoids this? ----- Original Message ---- <> -local-s tend to vanish once the -program- stops anyway, but you can of course -macro drop _all- should you so wish... Stata thinks your -local- "a" contains the string "b c=0", btw: *** loc a b c=0 di "`a'" *** HTH Martin From: Dani Tilley <tilleydani@yahoo.com> To: stata <statalist@hsphsun2.harvard.edu> Sent: Thu, August 5, 2010 1:59:03 PM Subject: Declaring several local variables at once Hi, I was wondering how you can declare more than one local var in one line. I tried -loc a b c=0- and it returned no error. But -di `a'- returned r(111). Also, is there a way to `drop' the locals after your program ends? Thanks in advance. DF Tilley * * 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/