Announcement

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

  • Help needed renaming list of variables with multiple identifiers nested within variable name

    Hi there,

    Long time reader, first time poster.

    I am currently trying to rename a large list of weight variables to better fit the syntax of my dataset

    Currently the variables are named wle"t"_"z" with "t" and "z" being combinations of e/p. I wish to rename the variables so that e=5, f=6 ... p=16.

    I also have variables that are named wle"t""z" that I wish to rename in a similar fashion.

    I would usually just just a loop in this situation but the two letters and the underscore contained within some of the variable names is confusing me.

    Any advice on how to tackle this would be much appreciated.

    Tim

  • #2
    An example of you data with dataex would make this a lot easier to understand and answer. See section 12.2. of the FAQ: https://www.statalist.org/forums/help#stata

    That said, Stata does not allow variable names starting with a number, so you'll have to reconsider (if I understand correctly what you are trying to do)
    See page 16 for variable naming conventions: https://www.stata.com/manuals13/u11.pdf

    Comment

    Working...
    X