Announcement

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

  • Is it possible to define two or more groups in dtable?

    In a large data set of various measurements (mean) examined different pathological conditions (pathology) from multiple organ (Region) sites in both treatment (tx) and control group (Con)

    I would like to make a table with descriptive statistics (mean and SD) and ttest for comparison og the tx and Con for the different pathologies and regions

    So far I cannot fint a way to make dtable command cathetorize by more than one group?

    In can do it for individual regions, i.e.;

    dtable mean if Pathology =="MLI" & Region == "Caudal lobe", by(Group, tests)


    ---------------------------------------------------------
    Group
    BPD C Total Test
    ---------------------------------------------------------
    N 9 (52.9%) 8 (47.1%) 17 (100.0%)
    mean 77.307 (10.528) 69.045 (8.197) 73.419 (10.143) 0.094
    ---------------------------------------------------------

    but is there a way I could get STATA to analyse for all regions in one table?

  • #2
    analyse for all regions in one table
    seems to contradict the thread title
    define two or more groups in dtable


    If you want all the regions in one table, just leave region out of the code:
    Code:
    dtable mean if Pathology == "MLI", by(Group, tests)
    If you want to group the results by more than just one variable, you have to create a new variable that indicates the different subgroups:
    Code:
    egen subgroup = group(Group Region), label
    dtable mean if Pathology == "MLI", by(subgroup, tests)
    With this, the test you will get is an F test contrasting all the subgroups.

    If neither of these is what you want, I suggest that when you post back you show an illustration of the desired result.

    As an aside, mean is not a good name for a variable. It is also the name of a Stata command, and an -egen- function. It's best to give everything a name that cannot be confused with anything else.

    Comment


    • #3
      Thanks

      Comment

      Working...
      X