Announcement

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

  • Presenting table in costumed format

    Hi,

    Is there anyway to produce table such as the following in same order?
    Number of Deaths
    icd10 Sex All ages 0-5 year 5-10 year 10-15 year 15-20 year 20-25 year
    A010 2 1 0 0 1 0 0
    A020 1 3 0 1 0 1 1
    A020 2 2 1 1 0 0 0
    A021 1 1 0 0 0 1 0

    Sample of data is here:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte Sex str4 icd10 double(age agegrp)
    2 "R99"                   100 5
    1 "A419"                    0 0
    2 "C809"                    0 0
    1 "I469"                    0 0
    2 "I469"                    0 0
    2 "I469"                    0 0
    2 "I469"                    0 0
    2 "I509"                    0 0
    1 "P073"                    0 0
    2 "P073"                    0 0
    1 "P073"                    0 0
    2 "P073"                    0 0
    2 "P071"                    0 0
    2 "P070"                    0 0
    2 "P070"                    0 0
    1 "P073"                    0 0
    2 "P073"                    0 0
    1 "P073"                    0 0
    1 "P072"                    0 0
    1 "P072"                    0 0
    1 "P073" .0027397260273972603 0
    1 "P073" .0027397260273972603 0
    1 "P070" .0027397260273972603 0
    2 "P073" .0027397260273972603 0
    1 "P219"                    0 0
    1 "P229"                    0 0
    1 "P220"                    0 0
    1 "P229"                    0 0
    2 "P220"                    0 0
    1 "P220"                    0 0
    2 "P220"                    0 0
    2 "P220"                    0 0
    1 "P220"                    0 0
    1 "P220"                    0 0
    1 "P220"                    0 0
    2 "P220"                    0 0
    2 "P220" .0027397260273972603 0
    1 "P220" .0027397260273972603 0
    2 "P239" .0027397260273972603 0
    1 "P239" .0027397260273972603 0
    1 "P269" .0027397260273972603 0
    1 "P280"                    0 0
    2 "P280"                    0 0
    1 "P280"                    0 0
    1 "P280"                    0 0
    2 "P280"                    0 0
    1 "P280"                    0 0
    2 "P280"                    0 0
    2 "P280"                    0 0
    1 "P280" .0027397260273972603 0
    1 "P280" .0027397260273972603 0
    2 "P280" .0027397260273972603 0
    1 "P280" .0027397260273972603 0
    1 "P293"                    0 0
    1 "P369"                    0 0
    1 "P369"                    0 0
    2 "P369"                    0 0
    2 "P361"                    0 0
    2 "P529"                    0 0
    2 "P529"                    0 0
    1 "P529"                    0 0
    1 "P529"                    0 0
    2 "P522"                    0 0
    2 "P529"                    0 0
    2 "P529"                    0 0
    1 "P529" .0027397260273972603 0
    2 "P524" .0027397260273972603 0
    1 "P548" .0027397260273972603 0
    2 "P612"                    0 0
    1 "Q000"                    0 0
    2 "Q000"                    0 0
    1 "Q000"                    0 0
    1 "Q000" .0027397260273972603 0
    2 "Q049"                    0 0
    1 "Q249"                    0 0
    1 "Q249"                    0 0
    1 "Q249"                    0 0
    2 "Q249"                    0 0
    2 "Q249"                    0 0
    2 "Q249" .0027397260273972603 0
    1 "Q249" .0027397260273972603 0
    2 "Q606"                    0 0
    2 "Q606"                    0 0
    1 "Q606"                    0 0
    1 "Q606"                    0 0
    2 "Q604"                    0 0
    1 "Q639"                    0 0
    1 "Q790" .0027397260273972603 0
    1 "Q878"                    0 0
    2 "Q878" .0027397260273972603 0
    2 "Q878" .0027397260273972603 0
    2 "Q897"                    0 0
    2 "Q897"                    0 0
    1 "Q897"                    0 0
    2 "Q897"                    0 0
    2 "Q898"                    0 0
    2 "Q897"                    0 0
    1 "Q897"                    0 0
    2 "Q897"                    0 0
    1 "Q897"                    0 0
    end
    label values Sex labels2
    label def labels2 1 "M", modify
    label def labels2 2 "F", modify

    Thanks in advance


  • #2
    Any help or suggestion is appreciated.

    I want the table at the end looks like similar to the below, but want to insert extra column for Sex variable, so each row has either 1 or 2 depending on Sex category. I have done this separately using tab icd10 agecat if Sex==1 and then past the result in excel file and did the same but for Sex==2 then combine it together. I just wonder if there is possible way to do it in Stata. The version that I am using is 16 SE.

    | RECODE of age
    ICD10 | 65+ 4 5 6 7 8 9 10 11 12 13 14 | Total
    -----------+------------------------------------------------------------------------------------------------------------------------------------+----------
    A099 | 2 0 0 0 0 0 0 0 0 0 0 0 | 2
    A159 | 1 0 0 0 0 0 0 0 0 0 0 0 | 1
    A162 | 1 0 0 0 0 0 0 0 0 0 0 0 | 3
    A169 | 5 0 0 0 0 0 0 0 0 0 0 0 | 9
    A170 | 0 0 0 0 0 0 0 0 0 0 0 0 | 1
    A379 | 0 0 0 0 0 0 0 0 0 0 0 0 | 1
    A419 | 201 0 0 0 0 0 0 0 0 0 0 0 | 277
    B181 | 2 0 0 0 0 0 0 0 0 0 0 0 | 5
    B182 | 1 0 0 0 0 0 0 0 0 0 0 0 | 3
    B189 | 1 0 0 0 0 0 0 0 0 0 0 0 | 2
    B190 | 0 0 0 0 0 0 0 0 0 0 0 0 | 1
    B199 | 1 0 0 0 0 0 0 0 0 0 0 0 | 1
    B212 | 0 0 0 0 0 0 0 0 0 0 0 0 | 1
    B213 | 0 0 0 0 0 0 0 0 0 0 0 0 | 1
    B24 | 0 0 0 0 0 0 0 0 0 0 0 0 | 3


    Thanks again!

    Comment

    Working...
    X