Announcement

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

  • Converting dstdize output into a data file for analysis

    Hello everyone, I would like help to extract the information in the output table of dstdize into a stata file so that I can then plot a graph showing how the age and sex-standardised incidence rate changes for each year. The "saving" option unfortunately does not include the required information. This question has previously been posed in a different thread (https://www.statalist.org/forums/for...stdize-results) but no solution was found.

    My dataset includes the absolute counts for a particular condition and the population size for each age-band and sex for each year. I have used dstdize to standardice the incidence rates arbitrarily on one of the years' (e.g. 1998) population structure and obtained the correct output using dstdize, but I can#t figure out a way to plot the graphs I need without manually writing out the output table in excel- this is what I need help with.

    Code:
     clear input year age_band sex count pop_size
    1998 1 1 4 60
    1998 1 2 5 80
    1998 2 1 2 50
    1998 2 2 5 10
    2005 1 1 3 87
    2005 1 2 6 67
    2005 2 1 7 65
    2005 2 2 3 45
    2010 1 1 1 100
    2010 1 2 0 30
    2010 2 1 5 60
    2010 2 2 7 40
    
    dstdize count pop_size age_band sex, by(year) base(1998)
    
    end
    The output I get is what I need:

    year N Crude rate Adjusted rate [95% conf. interval]

    1998 200 0.080000 0.080000 0.044883 0.115117
    2005 264 0.071970 0.076422 0.041088 0.111756
    2010 230 0.056522 0.032583 0.013230 0.051937


    How do I get this output table into a stata dataset?

    Many thanks in advance
    Markos

  • #2
    P.S. the help file shows the following, but I don't know how I can convert the output stored in these matrices into a stata file

    dstdize stores the following in r():

    Scalars
    r(k) number of populations

    Macros
    r(by) variable names specified in by()
    r(c#) values of r(by) for #th group

    Matrices r(se) 1×k vector of standard errors of adjusted rates r(ub adj) 1×k vector of upper bounds of confidence intervals for adjusted rates r(lb adj) 1×k vector of lower bounds of confidence intervals for adjusted rates r(Nobs) 1×k vector of number of observations r(crude) 1×k vector of crude rates (*) r(adj) 1×k vector of adjusted rates (*)

    Comment

    Working...
    X