Announcement

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

  • Calculate mean of each quantile/decile and get output in excel format

    Dear,

    Greetings. I like to calculate mean of each quantile on each date and take the output into a format like excel because I need to process data further. I have used the following code

    by mdate , sort : tabstat TotalReturnperShareasofMon , statistics( mean ) by(quant)

    to get mean of each quantile on each date where mdate = monthly date, TotalReturnperShareasofMon is the variables which is to be averaged for each quant group. When I use the above command the output is generated in Results window and output is too large that it cannot be seen or handled efficiently. I shared a screenshot of my data in attachment. I would like to know what is the efficient way to calculate mean of each quantile on each date and get output in tabular format like:

    mdate quant mean

    Thank you very much! Click image for larger version

Name:	Capture.JPG
Views:	1
Size:	66.1 KB
ID:	1559262

  • #2
    Code:
    collapse TotalReturnperShareasofMon , by(quant mdate)
    creates a dataset of means, which you can then export into MS Excel. It could well be that whatever else you want to do is still best done within Stata.

    Comment


    • #3
      Thank you very much for your prompt response. Yes ofcourse, I can do with stata. Actually I was wanting the results like stata data format which is easy to handle rather than results to appear in output window.

      Comment


      • #4
        -collapse-, by default, replaces the dataset in memory, so you can save the new dataset

        Comment


        • #5
          Stephen Jenkins is naturally right, and indeed I already answered #3 in #2: "creates a dataset of means, which you can then export into MS Excel".

          Comment

          Working...
          X