Announcement

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

  • Renaming variables into more accurate names

    Hello, I want to rename a variable into something more easily understandable however I keep running into an error 198. The problem follows below:

    Code:
    rename (lefthandside) (ln[H1/Ht]-2lnlnt)
    syntax error
        In parsing newname, either nothing or something invalid precedes the dash.  The dash syntax is varname-varname, and the variable names
        cannot have wildcard characters in them.
    r(198);
    I thought I could just relabel label my axis, since I want to create a scatterplot with ln[H1/Ht]-2lnlnt on the y-axis but then I run into the same problem:

    Code:
    scatter lefthandside lnt, title("Log-t regression: all clubs") xtitle("lnt") ytitle ("lnH1/Ht-2lnlnt") scheme (economist)
    "lnH1/Ht-2lnlnt invalid name
    r(198);
    How can I rename my variable
    lefthandside
    into
    ln[H1/Ht]-2lnlnt
    or label my y-axis in my scatterplot with?
    ln[H1/Ht]-2lnlnt

  • #2
    You cannot rename your variable as you are trying to because the Stata documentation tells us

    A name is a sequence of 1 to 32 letters (A–Z, a–z, and any Unicode letter), digits (0–9), and underscores (_).
    With regard to using the ytitle option, try removing the space that separates ytitle from the left parenthesis and see if that helps. Do the same for the space after scheme.

    Comment


    • #3
      thank you so much for your reply! I had figured it out but I did not know how to delete my post here

      Comment


      • #4
        Originally posted by George Kollias View Post
        thank you so much for your reply! I had figured it out but I did not know how to delete my post here
        You are not supposed to delete your post. Better post your solution so that others, who might have similar problems in the future, can find a helpful answer here.

        Best
        Daniel

        Comment


        • #5
          Building on Daniel's answer, Statalist is a Forum with many members and non-members who are reading along, and others who come intermittently and search the forum to find solutions to problems similar to their own. When I was teaching myself Stata, I spent several months quietly following along, reading questions and working out the answers as best I could, then checking my answer against the posted answers. So, please share what you have learned with others, just as we share our knowledge with you. And if you share your solution promptly, it will serve to let others know that they need not invest effort in solving a problem that has already been solved.

          These sorts of details about Statalist are shared in the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. It's a good place to look for answers to questions like "how do I delete my post", If you have't already done so, please take a few moments to familiarize yourself with the FAQ.

          Comment


          • #6
            Thank you for you remark, I will take a closer look next time at all the details!

            Comment

            Working...
            X