Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[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 <hewan_belay@yahoo.com>
To   statalist@hsphsun2.harvard.edu
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 <n.j.cox@durham.ac.uk> wrote:

> From: Nick Cox <n.j.cox@durham.ac.uk>
> Subject: st: RE: AW: RE: RE: variable labels and reshape--reinserting en masse
> To: statalist@hsphsun2.harvard.edu
> 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 
> n.j.cox@durham.ac.uk
> 
> 
> Stefan.Gawrich@hlpug.hessen.de
> 
> 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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index