I'm reasonably sure I'm missing something very simple with this question. Basically, I have two tables with the same layout that I'd like to append to one another so I can show a comparison of the whole sample to a subset.
This is the result (or similar) I'm trying achieve.

Perhaps there is an easier way of accomplishing this task but I also wanted to work more with the table and collect commands to have some additional experience with them.
Please see the sample code below that I've tried:
I've seen something similar work, however, the "Row" var was different: such as race in Table 1 and Sex in Table 2 with the result being an average of weight. I assumed the table () (), append command would do the trick but I believe that has different functionality than how I read the documentation.
Thanks in advance for the the assistance.
Chris.
This is the result (or similar) I'm trying achieve.
Perhaps there is an easier way of accomplishing this task but I also wanted to work more with the table and collect commands to have some additional experience with them.
Please see the sample code below that I've tried:
Code:
webuse nhanes2, clear // Create a table for the general sample in the dataset -- Table 1 table race (diabetes agegrp), statistic(median bpsystol) total(diabetes#race) // Exclude all but those in "Poor" health (hlthstat == 5) and recreate the table above -- Table 2 table race (diabetes agegrp) if hlthstat==5, statistic(median bpsystol) total(diabetes#race) append // Rename "race" for the "poor health" table collect label levels var race "Poor Health", modify // Set the new layout Table 1 first then Table 2 collect layout (race race) (result)
Thanks in advance for the the assistance.
Chris.
Comment