Hi All,
I'm looking to generate a "Table 1", and having recently upgraded to Stata 18, am attempting to use dtable. Generally speaking it's great, however because my continuous variables are skewed I need to report median and interquartile range rather than mean and standard deviation. This is the code I've used at the base level:
However, you can see that the median and IQR are just one after the other, and I'd like to add some characters to aid interpretability. Ideally, something like:
I've attempted to achieve this by using both the sformat command within dtable, and even combining dtable with the collect commands, but have not yet had any luck. Can anyone assist me to achieve a more interpretable outcome?
Thanks in advance,
Marissa
I'm looking to generate a "Table 1", and having recently upgraded to Stata 18, am attempting to use dtable. Generally speaking it's great, however because my continuous variables are skewed I need to report median and interquartile range rather than mean and standard deviation. This is the code I've used at the base level:
Code:
dtable client_days_at_risk client_age i.gender_collapse if episode_counter==1, by(overall_service) continuous(client_days_at_risk client_age, statistics(med p25 p75)) ------------------------------------------------------------------------------------------- Service Type for Episode (Health vs ACC) Health ACC Total ------------------------------------------------------------------------------------------- N 69,757 (64.1%) 39,064 (35.9%) 108,821 (100.0%) Total Client Days at Risk 33.000 7.000 164.000 282.000 96.000 427.000 83.000 15.000 334.000 Client Age 67.000 51.000 80.000 82.000 76.000 88.000 75.000 61.000 84.000 Gender Male 32,128 (46.1%) 13,627 (34.9%) 45,755 (42.0%) Female 36,769 (52.7%) 25,178 (64.5%) 61,947 (56.9%) Other 469 (0.7%) 151 (0.4%) 620 (0.6%) Missing 391 (0.6%) 108 (0.3%) 499 (0.5%) -------------------------------------------------------------------------------------------
Code:
------------------------------------------------------------------------------------------- Service Type for Episode (Health vs ACC) Health ACC Total ------------------------------------------------------------------------------------------- N 69,757 (64.1%) 39,064 (35.9%) 108,821 (100.0%) Total Client Days at Risk 33 (7 - 164) 282 (96 - 427) 83 (15 - 334) Client Age 67 (51 - 80) 82 (76 - 88) 75 (61 - 84) Gender Male 32,128 (46.1%) 13,627 (34.9%) 45,755 (42.0%) Female 36,769 (52.7%) 25,178 (64.5%) 61,947 (56.9%) Other 469 (0.7%) 151 (0.4%) 620 (0.6%) Missing 391 (0.6%) 108 (0.3%) 499 (0.5%) -------------------------------------------------------------------------------------------
I've attempted to achieve this by using both the sformat command within dtable, and even combining dtable with the collect commands, but have not yet had any luck. Can anyone assist me to achieve a more interpretable outcome?
Thanks in advance,
Marissa
Comment