Announcement

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

  • Table with multiple column and rows

    I want to create One Table with multiple Columns and multiple rows. The STATA 16 drop-down menu gives only limited commands. For my table, I have 4 columns and 20 rows. Thanks in advance

  • #2
    That could be many different tables. They might come out of several different commands. You might as well as ask for a graph with two axes.

    Please tell us about your data and what specifically and precisely you want to tabulate.

    Comment


    • #3
      This is my data and I want to create a table with four columns ENG, ACVRL1, SMAD4, RASA1 and I want the following things in the Rows ID, GENDER, RACE, WEIGHT, HEIGHT


      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input byte id int(eng acvrl1) byte smad4 int rasa1 str6 gender str15 race int(weight height)
       1   25   3   2   5 "Male"   "Asian"            65 111
       2   50   6   4  10 "Female" "White"            45 222
       3   75   9   6  15 "Female" "While"            65 334
       4  100  12   8  20 "Female" "White"            34 443
       5  125  15  10  25 "Female" "While"            78 445
       6  150  18  12  30 "Female" "White"            56 665
       7  175  21  14  35 "Female" "While"            34 777
       8  200  24  16  40 "Female" "White"            56 654
       9  225  27  18  45 "Female" "While"           110 123
      10  250  30  20  50 "Female" "White"            90 345
      11  275  33  22  55 "Female" "While"            78 544
      12  300  36  24  60 "Female" "White"            74 334
      13  325  39  26  65 "Female" "While"            56 776
      14  350  42  28  70 "Female" "Black"            76 444
      15  375  45  30  75 "Female" "Black"            45 665
      16  400  48  32  80 "Female" "Black"            34 887
      17  425  51  34  85 "Female" "Black"            56 900
      18  450  54  36  90 "Female" "Black"            67 456
      19  475  57  38  95 "Female" "Black"            56 543
      20  500  60  40 100 "Female" "Black"            76 234
      21  525  63  42 105 "Female" "Black"            87 345
      22  550  66  44 110 "Female" "Black"            99 654
      23  575  69  46 115 "Female" "Black"           112 556
      24  600  72  48 120 "Female" "Black"            56 556
      25  625  75  50 125 "Female" "Black"            65 556
      26  650  78  52 130 "Female" "Black"            45 556
      27  675  81  54 135 "Female" "Black"            65 556
      28  700  84  56 140 "Male"   "Black"            66 556
      29  725  87  58 145 "Male"   "Asian"            76 556
      30  750  90  60 150 "Male"   "Asian"            78 556
      31  775  93  62 155 "Male"   "Asian"            67 556
      32  800  96  64 160 "Male"   "Asian"            67 556
      33  825  99  66 165 "Male"   "Asian"            67 345
      34  850 102  68 170 "Male"   "Asian"            54 345
      35  875 105  70 175 "Male"   "Asian"            54 345
      36  900 108  72 180 "Male"   "Asian"            56 345
      37  925 111  74 185 "Male"   "Asian"            45 345
      38  950 114  76 190 "Male"   "Asian"            45 345
      39  975 117  78 195 "Male"   "Asian"            67 345
      40 1000 120  80 200 "Male"   "Asian"            77 345
      41 1025 123  82 205 "Male"   "Asian"            29 345
      42 1050 126  84 210 "Male"   "Asian"            38 345
      43 1075 129  86 215 "Male"   "Asian"            47 345
      44 1100 132  88 220 "Male"   "Asian"            57 345
      45 1125 135  90 225 "Male"   "Native American"  46 234
      46 1150 138  92 230 "Male"   "Native American"  67 211
      47 1175 141  94 235 "Male"   "Native American"  56 234
      48 1200 144  96 240 "Male"   "Native American"  56 654
      49 1225 147  98 245 "Male"   "Native American"  65 456
      50 1250 150 100 250 "Male"   "Native American"  56 434
      end

      Comment


      • #4
        Sorry, what goes in the cells of the table? How is that 20 rows?

        Comment


        • #5
          mean frequencies and percentage

          Comment


          • #6
            Sorry again, but I fail utterly to follow what that means. Setting aside your identifier you specify some variables that are categorical and some that measured. I can’t see how those map on to a twoway table. Someone else may be able to help.
            Last edited by Nick Cox; 28 Jan 2020, 00:57.

            Comment


            • #7
              Sorry for not writing clearly. Here is revise data with all questions.

              I want to create a table with multiple rows and columns. In the columns, I want to place ENG, ACVRL1, SMAD4, GDF3 and last columns with p-value (difference among these groups)
              In the row I want to see mean, SD, % of Age, Race, Ethnicity, Occupation.

              Either the command will be tab_chi or tabm, but I am not sure exactly how to do this. Please write the syntax code as well. Thank you in advance.

              Code:
              * Example generated by -dataex-. To install: ssc install dataex
              clear
              input byte(eng acvrl1 smad4 gdf2 age race ethnicity occupation)
              1 0 0 0 16 1 2 1
              1 0 0 0 45 1 2 1
              1 0 0 0 43 1 2 1
              1 0 0 0 67 1 2 1
              1 0 0 0 89 1 2 1
              1 0 0 0 23 1 2 1
              1 0 0 0 45 1 2 1
              1 0 0 0 56 1 2 1
              1 0 0 0 76 1 2 1
              1 0 0 0 45 1 2 1
              1 0 0 0 35 1 2 1
              1 0 0 0 98 1 2 1
              1 0 0 0 23 1 2 1
              1 0 0 0 41 1 2 1
              1 0 0 0 50 1 2 1
              1 0 0 0 39 1 2 1
              1 0 0 0 32 1 2 1
              0 1 0 0 47 1 2 1
              0 1 0 0 58 2 2 1
              0 1 0 0 61 2 2 2
              0 1 0 0 59 2 2 2
              0 1 0 0 40 2 2 2
              0 1 0 0 43 2 2 2
              0 1 0 0 23 2 2 2
              0 1 0 0 34 2 2 2
              0 1 0 0 54 2 1 2
              0 1 0 0 34 2 1 2
              0 1 0 0 56 2 1 2
              0 0 1 0 54 2 1 2
              0 0 1 0 34 3 1 2
              0 0 1 0 76 3 1 2
              0 0 1 0 54 3 1 2
              0 0 1 0 34 3 1 3
              0 0 1 0 45 3 1 3
              0 0 1 0 23 3 1 3
              0 0 1 0 34 3 1 3
              0 0 0 1 43 3 1 3
              0 0 0 1 56 3 1 3
              0 0 0 1 76 3 1 3
              0 0 0 1 78 3 1 3
              0 0 0 1 50 3 3 3
              0 0 0 1 76 3 3 3
              0 0 0 1 19 3 3 3
              0 0 0 1 31 4 3 3
              0 0 0 1 41 4 3 4
              0 0 0 1 36 4 3 4
              0 0 0 1 56 4 3 4
              0 0 0 1 67 4 3 4
              0 0 0 1 78 4 3 4
              end

              Comment


              • #8
                the command will be tab_chi or tabm
                I can be definite on that I wrote those packages (on SSC) and this desire is nothing to do with any of them.

                I still don't know what you want really. If you have 4 groups, I don't know where a P-value for differences would come from. Perhaps analysis of variance, but you need to amalgamate the indicators for those 4 groups.

                In order to stop a string of unhelpful comments, I am now bailing out of this thread. I think you may need to find someone at your workplace who knows more Stata. Otherwise this isn't working well for you. Sorry about that.

                Comment


                • #9
                  Hello Dr Nick,


                  I want to create a table like this.

                  In my origical data there are 8 row variables and only two column variables. I don't want the row variables to be nested into each other.


                  No Hypertension Hypertension
                  Age Mean (SD) Mean (SD)
                  Gender
                  Male Frequency (Row percentage) Frequency (Row percentage)
                  Female Frequency (Row percentage) Frequency (Row percentage)
                  Smoking Status
                  Never Smoker Frequency (Row percentage) Frequency (Row percentage)
                  Past Smoker Frequency (Row percentage) Frequency (Row percentage)
                  Current Smoker

                  Residence
                  Urban
                  Rural


                  Frequency (Row percentage)

                  Frequency (Row percentage
                  Frequency (Row percentage
                  Frequency (Row percentage)

                  Frequency (Row percentage
                  Frequency (Row percentage

                  input float(knowledge1 knowledge2 knowledge3 knowledge4 knowledge5 knowledge6 educationm)
                  0 1 1 1 0 1 1
                  0 1 1 1 1 0 1
                  0 0 0 0 0 1 1
                  1 1 0 0 0 0 5
                  1 1 1 1 1 0 3
                  0 1 0 0 0 1 1


                  I am using the following command but it not doing what I want.


                  table (knowledge*) (educationm), statistic(frequency) statistic(percent, across(educationm))


                  Please help me!!!!!!!!!!

                  Comment


                  • #10
                    The table in #9 looks more like what medical/biostatistical people call Table 1 than it resembles the results of the table commands familiar to me. It's not related to any of the tabulation wrappers I've ever written. It may well be possible with the new table command.

                    Comment


                    • #11
                      There are two series of posts on the Stata blog about creating tables using putexcel and tables. I would agree with Nick. That you’re after a “Table 1” descriptive table. I also share his confusion about how your data are structured versus the table you report to want. You may have to restructure your data first. Either way, I’m not in front of Stata so I can’t say more.

                      Comment

                      Working...
                      X