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: re: st: Package -r2c- now available in SSC
From
Simon Falck <[email protected]>
To
"[email protected]" <[email protected]>
Subject
RE: re: st: Package -r2c- now available in SSC
Date
Tue, 5 Feb 2013 20:07:56 +0000
Thanks Nick and Maarten for your insights on the -r2c-. Very good comments and suggestions.
Simon
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Maarten Buis
Sent: den 5 februari 2013 20:38
To: [email protected]
Subject: Re: re: st: Package -r2c- now available in SSC
On Tue, Feb 5, 2013 at 7:46 PM, Nick Cox wrote:
> I note in passing that -r2c- evidently feels free to use the variable
> names
>
> mu mumean wt _est_full counts alpha
>
> so that it will -drop- any previous instances and then overwrite them
> with new ones. This is not documented so far as I can see. Correct me
> if I am wrong, such practices are widely regarded as dangerous Stata
> programming style. Some of these names look highly likely to appeal to
> people fitting count models.
To add to this: the typical way in which this is circumvented is to use temporary variables. So you would do something like:
tempvar mu mumean wt _est_full counts alpha gen `mu' = ...
egen `mumean' = ...
etc.
the variables `mu' , `mumean', etc. (notice the -`- and the -'-, they are necesary) will have unique names that do not exist in your data, they will exist as long as the program runs and will be deleated when the program ends. That way you do not change the data (unless the user explicitly asks for it), which is typically considerd good practice in this community.
-- Maarten
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany
http://www.maartenbuis.nl
---------------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/