Announcement

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

  • Graphing by year?

    Good afternoon everyone,

    I am fairly new to stata and am struggling with the graphing aspect. Namely, I am trying to create a graph, sorted by year of data collection. What is the function I use to do that, rather than the list of numbers stata generates?

    Thanks!

  • #2
    Welcome to Statalist, and to Stata.

    Your question really isn't clear without more detail, or at a minimum it is too difficult to guess at a good answer from what you have shared. Please help us help you. Show example data. Show your code and the plot Stata created. The Statalist FAQ provides advice on effectively posing your questions, posting data, and sharing Stata output.

    Comment


    • #3
      This is the graph stata gave me. I want to change my x-axis to actual years, rather than 50, 100, etc.Screen Shot 2022-01-22 at 3.12.39 PM.png

      Comment


      • #4
        Without knowing what your data are like it is hard to advise you.

        I have a feeling however that you imported your data into Stata in such a way that your Year_Recorded variable was created as a string variable, and you then used the encode command to change it from a string to a numeric variable.

        If that is what you did, you have made a mistake that you need to correct.

        The encode command is designed for assigning numerical codes to non-numeric strings like "France", "Germany", "United States". The output of help encode instructs us

        Do not use encode if varname contains numbers that merely happen to be stored as strings; instead, use generate newvar = real(varname) or destring; see real() or [D] destring.

        Comment

        Working...
        X