Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: RE: AW: RE: RE: variable labels and reshape--reinserting en masse
From
Hewan Belay <[email protected]>
To
[email protected]
Subject
Re: st: RE: AW: RE: RE: variable labels and reshape--reinserting en masse
Date
Mon, 19 Apr 2010 09:47:49 -0700 (PDT)
Dear Martin,
Excellent, your fix of my command worked. Two main lessons learned: I placed two `' brackets next to each other instead of nesting them, i.e. I did `myvarlab_'`y' instead of doing `myvarlab_`y''. Second, I shouldn't have used -for any- and instead should have used -foreach ... in-. In fact, I didn't know that -for- was dead (thanks Nick for bringing me 7 years into the present!) -for any- has been my workhorse since I started using stata. I'll do my best to wean myself off of it, but it will take some time!
Thanks all,
Hewan
--- On Mon, 4/19/10, Nick Cox <[email protected]> wrote:
> From: Nick Cox <[email protected]>
> Subject: st: RE: AW: RE: RE: variable labels and reshape--reinserting en masse
> To: [email protected]
> Date: Monday, April 19, 2010, 3:20 PM
> I guess that is never going to
> happen.
>
> I don't know if you were using Stata around 2000, but no
> end of messes
> followed people's misunderstanding of how local macros
> worked with
> -for-.
>
> One-line loops and macros really don't mix in the way that
> many users
> would want because local macros are necessarily interpreted
> before
> execution. My FAQ explains in more detail:
>
> Stata 7: Why do I get puzzling results with the for command
> and local or
> global macros?
> http://www.stata.com/support/faqs/lang/macros.html
>
> Nick
> [email protected]
>
>
> [email protected]
>
> I personal think that the idea of one-liner-loops including
> parallel
> lists is still a good one.
> A successor that overcomes some of the limitations
> discussed be???e and
> uses locals instead of capital letters
> would be a nice addition to the Stata toolbox.
>
> *
> * 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/