Announcement

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

  • Export adjusted ratios from dstdize command

    Dear all,

    Really appreciate if someone could kindly help me. I'm using
    Code:
    dstdize
    command to calculate adjusted rate (prevalence) of a disease for two comparative group. The output table is quite clear on Stata, but I would like to export only the adjusted ratios to a Word or Excel file. I'm wondering if there is a better way to do so apart from copy and paste one by one manually (especial I use a
    Code:
    foreach
    command to calculate ratios for over 40 diseases or at least to have only the Summary of Study Populations to display (the bottom part as shown below)?

    This is the example from Stata manual:

    Code:
    dstdize deaths pop age_cat, by(nation) using(1962)
    -> nation= Panama
    Unadjusted Std.
    Pop. Stratum Pop.
    Stratum Pop. Cases Dist. Rate[s] Dst[P] s*P
    0 - 29 741000 3904 0.689 0.0053 0.350 0.0018
    30 - 59 275000 1421 0.256 0.0052 0.350 0.0018
    60+ 59000 2456 0.055 0.0416 0.300 0.0125
    Totals: 1075000 7781 Adjusted Cases: 17351.2
    Crude Rate: 0.0072
    Adjusted Rate: 0.0161
    95% Conf. Interval: [0.0156, 0.0166]
    -> nation= Sweden
    Unadjusted Std.
    Pop. Stratum Pop.
    Stratum Pop. Cases Dist. Rate[s] Dst[P] s*P
    0 - 29 3145000 3523 0.420 0.0011 0.350 0.0004
    30 - 59 3057000 10928 0.408 0.0036 0.350 0.0013
    60+ 1294000 59104 0.173 0.0457 0.300 0.0137
    Totals: 7496000 73555 Adjusted Cases: 115032.5
    Crude Rate: 0.0098
    Adjusted Rate: 0.0153
    95% Conf. Interval: [0.0152, 0.0155]

    Summary of Study Populations:
    nation N Crude Adj_Rate Confidence Interval
    Panama 1075000 0.007238 0.016141 [ 0.015645, 0.016637]
    Sweden 7496000 0.009813 0.015346 [ 0.015235, 0.015457]

    All I need are the adjusted rate for each country at the very end of the table (0.016141 for Panama and 0.015346 for Sweden).

    Thank you.
    Last edited by Hark Huang; 07 Sep 2021, 15:53.

  • #2
    these are "saved" in the returned matrix "r(adj)"; this is always, but only temporarily saved by Stata and available for your use; I suggest you first make a new matrix (so that it won't disappear on you) and then use as you see fit; see
    Code:
    help matrix
    and in particular the following:
    Code:
    help matrix define
    help matrix extraction

    Comment


    • #3
      Originally posted by Rich Goldstein View Post
      these are "saved" in the returned matrix "r(adj)"; this is always, but only temporarily saved by Stata and available for your use; I suggest you first make a new matrix (so that it won't disappear on you) and then use as you see fit; see
      Code:
      help matrix
      and in particular the following:
      Code:
      help matrix define
      help matrix extraction
      Thank you Rich : )

      Comment

      Working...
      X