Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Renvars replacement?

    Hi, I'm working on a group project with someone whose version still supports renvars, which mine doesn't since I have the newest Stata version. I want to add a suffix of "_R" or "_D" to a large group of variables. I'll show the code with renvars below and then I would love recommendations on how to do it without renvars! Thanks!
    Code:
    keep if party=="R"
    renvars CC18_328a-CC18_326 , postfix(_R)

  • #2
    The question is the wrong way round. renvars is community-contributed

    Code:
    SJ-5-4  dm88_1  . . . . . . . . . . . . . . . . .  Software update for renvars
            (help renvars if installed) . . . . . . . . .  N. J. Cox and J. Weesie
            Q4/05   SJ 5(4):607
            trimend() option added and help file updated

    and should work if and only if you have installed it and you have Stata 8 upwards. But it's been superseded. for the most part, by updated rename as from Stata 12. (Just possibly renvars can do some renaming that rename can't without a loop. On the whole, the new rename is preferable.)

    Code:
    rename (CC18_328a-CC18_326)  (=_R)
    is the modern way to do those renames, and coordination with your colleague is best done by your both using rename, provided you both have Stata 12 or later.

    renvars was more versatile than the official command between 2001 and the release of Stata 12 in 2011, but its decade of having an edge is now a decade ago.
    Last edited by Nick Cox; 03 Jul 2021, 16:04.

    Comment

    Working...
    X