Announcement

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

  • What table command to use for correct frequency total?

    Dear All,

    I am trying to get the sum of patient cases per year in each age group, MDC and country. I used the code egen tabid= group(Agegroup_new MDC_new), label to group agegroup and MDC and everything has the same total of patient cases per agegroup in each year and MDC when I manually calculate it from the data editor but when I want to create a table, using the command asdoc tabulate tabid Year if Country=="US", summarize(patientcases) freq, I got a whole different result. Kindly see the screenshot I attached. Aged 0-14 should have 0 cases of breast problems in year 2018 but here it shows there are 14 cases in years 2018 which is totally wrong and it shows the same result for age 15-39 when in fact aged 15-39 has 56 cases of breast problem in year 2018. I wonder if there is a different command to create a table to show the exact total number of patient cases per year in every MDC and agegroup? I tried using dataex to show a sample data but I couldn`t figure out how to show the table using dataex, hence I am attaching a screenshot. I hope someone can help me with this. Thank you

    Command:

    egen tabid= group(Agegroup_new MDC_new), label

    asdoc tabulate tabid Year if Country=="US", summarize(patientcases) freq
    Click image for larger version

Name:	Screenshot 2022-10-31 103944.png
Views:	1
Size:	71.6 KB
ID:	1687407



    Sincerely,
    Rosie Syy
    Last edited by Rosie Syy; 31 Oct 2022, 04:05.
Working...
X