Announcement

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

  • Question: Rename to lowercase for not just dataset in use

    Hello,

    I am merging various datasets.
    The datasets generally have the same case in their variables, but I noticed that some of them have variable 'caseid' whereas others have 'CaseID' for example (or 'sex', 'Sex' etc).

    I am now using these commands:

    Code:
    use dataset_1
    rename *, lower
    merge 1:1 caseid using dataset_2
    The problem with this is that dataset_2 might have some uppercase.
    The only different way I can think of is:

    Code:
    use dataset_1
    rename *, lower
    use dataset_2
    rename *, lower
    merge 1:1 caseid using dataset_1
    Is there a way to include the rename variables for a dataset not in use?

    Thank you.

  • #2
    I don't think there is any way to apply -rename- to a data set that is not open. My thought is that prior to doing these merges it might make sense to go through all of the data sets and -rename *, lower-. After all, regardless of what you are going to do with these data sets, having that discrepancy in naming can't be helpful.

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      I don't think there is any way to apply -rename- to a data set that is not open. My thought is that prior to doing these merges it might make sense to go through all of the data sets and -rename *, lower-. After all, regardless of what you are going to do with these data sets, having that discrepancy in naming can't be helpful.
      Understood. The database for a specific year did not adhere to the lowercase naming convention. Thank you!

      Comment

      Working...
      X