Announcement

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

  • Group mean and separating data into 3 groups

    Hi, I have a large set of data sets and multiple variables. I want to do the following:

    1. First I want to divide my variables into three groups (pre, post and between) based on year. For example, If the year is less than in 1990 it is pre_period. If the year is more than in 1995 it is post_period and if the year is between 1990 and 1995 then this group is "between". I don't know how to do that in STATA.

    2. I want to find mean difference of many variables such as ROA, ROE, TA, CASH, R&D, CAPX and many others variables between pre and post period. I can do ttest for each variable separately but is there any way I can do them all together and find the mean difference in one table? There is another problem. Since I have three groups of data in my data set how can I do that pre post difference?

    3. I want to get the output of mean difference in an excel table with significant result. Can I do that with Outreg2? if so,
    how is that?

    Can anyone please help me?

  • #2
    You will improve your chances of a useful answer by following the FAQ on asking questions.

    Almost everything in Stata allows a "by" statement or an "if" condition. You
    g period=1 if year<1990
    eplace period==2 if year >1989 & year<1996
    replace year==3 if period >1995

    The rest depends on how you do the first.

    Comment


    • #3
      Thank you Phil.

      After I group them into three, how will I test for each separate group?
      I want to use the following regression for the pre and post-crisis: How will I do that for each group?

      xtreg roa return size cash mkt i.year, fe vce(robust)

      I can use

      sort pre_period
      by pre_period: xtreg roa return size cash mkt i.year, fe

      But the above doesn't allow me to use vce(robust)
      Last edited by Raja Hasan; 24 Mar 2020, 07:25.

      Comment

      Working...
      X