Announcement

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

  • how to reshape my data set

    Hello,

    I am having trouble reshaping my data how i want it. What's the easiest way to reshape it? The id variable isn't important so i can drop it if necessary.

    I wanted my output to only be three rows like this:

    Descriptive varx vary
    male x x
    female x x
    white x x
    Hispanic or Latino x x
    other x x
    no college x x
    college x x
    union x x
    no union x x

    Here is my dataset:

    Click image for larger version

Name:	reshape example.PNG
Views:	6
Size:	27.1 KB
ID:	1554871





  • #2
    First, you have multiple posts on the same topic. If you did that intentionally, please don’t. If that was an accident, then no matter.

    Second, you said you wanted your data to be in 3 rows, but you presented output in 3 columns with many more than 3 rows. It’s not clear to me how to reshape or otherwise convert your data into the format you asked for.

    Third, you seem to be presenting a series of summary statistics. It’s almost as you are showing the mean of two variables by various descriptive characteristics. Maybe you should be using the mean command, e.g.

    Code:
    mean xvar yvar, over(GENDER)
    Alternatively, the tabstat command also gets you the mean or a number of other summary statistics.
    Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

    When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

    Comment

    Working...
    X