Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: revising -rename- [was:RE: st: quick question]

From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: revising -rename- [was:RE: st: quick question]
Date   Thu, 26 Feb 2004 15:40:16 +0000

At 12:48 26/02/04 +0000, Nick Cox wrote (re the syntax of -rename-):

So let's try that. Start with -rename-, and redesign it to
cope with more general cases. Adding a bunch of options,
like those of -renvars- or something similar, is not a big
deal. It's designing what comes before the comma which is
the key detail.

The implementation I'll optimistically assign
to StataCorp, as this really should _not_ be an .ado. It
should be part of the executable. The existing syntax
(which I'll call Syntax 1) is

Syntax 1: . rename oldname newname

(and for compatibility we really must keep that) and
it could generalise to

Syntax 2: . rename oldname1 [oldname2 [oldname3 ... ]]
        newname1 [newname2 [newname3 ... ]]


Syntax 2:. rename oldvarlist newvarlist

or to

Syntax 2': . rename oldname1 newname1 [oldname2 newname2
        [ oldname3 newname3 ... ]]

Both of those collapse to the existing syntax.
For what it's worth, I prefer Syntax 2', because, that way, it is clear which oldname is to be replaced with which newname. That is why I used (essentially) Syntax 2' in the -rename()- options of -descsave-, -parmest- and -parmby- (available either on SSC or on my website as specified in my signature). However, if you use Syntax 2', then it is probably a good idea to include a diagnostic in the case of an odd number of names, such as

Warning: odd number of variable names in rename list - last one ignored

(as used by my programs) or possibly a stronger error-level diagnostic.


Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]

Opinions expressed are those of the author, not the institution.

* For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index