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.
    Please use the code delimiters to show code and results - use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

    Please use the command -dataex- to show a representative sample of data; it is installed already if you have Stata 14.2 or 15.1, else you can install it by typing

    Code:
    ssc install dataex

    Comment

    Working...
    X