Announcement

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

  • Graphing Means in Stata

    Hello!

    I'm very new at using Stata (my background is mostly SPSS).

    I'm trying to do the following:

    Create a graph that plots the mean of a variable (called DRS) over four time points (called data_point), by location (called LTCH) and by gender.

    I would like the y axis to be the mean of DRS for each location and gender and the x axis to be data point (there is a variable called data point that tells me which time point each score is from 1-4), and I would like to have 6 lines:

    Location 1 Male
    Location 1 Female
    Location 2 Male
    Location 2 Female
    Location 3 Male
    Location 3 Female

    So y is mean of DRS, x is data_point, and the lines are a mix of location and gender.

    The two main things causing me issues is I don't know how to get it to do the 6 lines, and I don't know how to get it to do the MEAN of the DRS.

    I also want to set a specific scale for the y axis (0 to 14)

    If anyone can help or direct me to resources that will help that would be great. I tried the "Visual overview for creating graphs" and read the manual suggestions but I can't seem to find the answer to my question.

    Thank you!

  • #2
    I think your chances of getting a timely and helpful response would be greatly improved if you reposted your question with an excerpt from your data, using the -dataex- command. If you are running version 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    Even the most well-intended descriptions of data sets simply don't convey enough information.

    When asking for help with code, always show example data. When showing example data, always use -dataex-.

    Comment


    • #3
      Thank you, I re-posted the question with code.

      Comment

      Working...
      X