Hello,
Using data from (use https://www.stata-press.com/data/r18/nhanes2l) as an example, can we add a new column in the output table for percentage of Total columns only. For example
when I did
, I got this table
but I do not want the percentages to appear in each row, instead I want to add a new column for %total, can that be achieved in Stata because I heard that the new update has fully customizable tables commands like collect and dtable, I am using Stata V16.
Thanks in advance!
Using data from (use https://www.stata-press.com/data/r18/nhanes2l) as an example, can we add a new column in the output table for percentage of Total columns only. For example
when I did
Code:
tab sex race, col
| Race | |||||
| Sex | White | Black | Other | Total | |
| Male | 4,312 | 500 | 103 | 4,915 | |
| 47.57 | 46.04 | 51.5 | 47.48 | ||
| Female | 4,753 | 586 | 97 | 5,436 | |
| 52.43 | 53.96 | 48.5 | 52.52 | ||
| Total | 9,065 | 1,086 | 200 | 10,351 | |
| 100 | 100 | 100 | 100 |
but I do not want the percentages to appear in each row, instead I want to add a new column for %total, can that be achieved in Stata because I heard that the new update has fully customizable tables commands like collect and dtable, I am using Stata V16.
| Race | |||||
| Sex | White | Black | Other | Total | %Total |
| Male | 4,312 | 500 | 103 | 4,915 | 47.48 |
| Female | 4,753 | 586 | 97 | 5,436 | 52.52 |
| Total | 9,065 | 1,086 | 200 | 10,351 | |
| 100 | 100 | 100 | 100 |
Thanks in advance!

Comment