Announcement

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

  • How to make a table with multiple variables?

    I want to make a table that looks like:
    Rate of Graduation (%)
    Parent’s Years of Education Tall Short
    9
    10
    11
    12
    13
    Etc until 20
    All

    I made a binary variable that says child_degree, which equals 1 if the child received a college degree or higher, and equals zero otherwise like so: (I hope I did this right)

    Now I want to create a table like the one above to show the fraction of college graduates by each year of parent's education, for tall and short children. I'm not sure how to do this.

    My variable are
    tall = 1 if the child is tall and = 0 if child is short
    p_edu number of years of parent's education

    how do i write the code for the table? (thank youuu)

  • #2
    The table below shows the fraction (0-1) of college or higher in each cell.

    Code:
    table p_edu tall, c(mean child_degree)

    Comment


    • #3
      It tells me that "option contents() not allowed since Stata 17"

      Comment


      • #4
        -table- is a comand that underwent huge changes to the point that it's basically a different command, starting in Stata 17. Fei Wang 's syntax is meant for "old" -table-. You can still access it, though not obvious to a newcomer, by the following:

        Code:
        version 16: table p_edu tall, c(mean child_degree)
        Stata maintain a version control of commands and using a version prefix is one way to assert that you want some earlier behaviour.

        Comment


        • #5
          Thank you Leonardo! I'm confused about the code of mean here. Why is it mean? If I'm trying to see the fraction/percentage of college graduates by each year of parent's education, for tall and short children?

          Comment


          • #6
            If the variable is coded 0/1 for short/tall, then the mean of that variable is going to be the proportion of "tall" (or 1). The opposite is true if you reverse the 0/1 coding to get the proportion of "short".
            Last edited by Leonardo Guizzetti; 24 Nov 2021, 11:23. Reason: fixed typo

            Comment


            • #7
              Leonardo Guizzetti , thanks for the information. I'm still loyal to 16 now, and may need to learn a lot of new stuff when updating to a new version.

              Comment


              • #8
                No problem, Fei.

                Comment

                Working...
                X