Announcement

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

  • Sum variables and division of the result


    Hi,

    I would like to sum two variables of my sample and then divide these two results together. Finally I would like to export both sum and the result of the division.

    I found a way for both sum but I do not find how to proceed for the division. I have the following code :

    Code:
    .estpost tabstat VARIABLE1 if year == 2008, statistics(sum)
    .esttab, wide nonumber cell("sum(label(Total Variable1 in 2008))")
    .mat II = e(sum)'
    .estpost tabstat VARIABLE2 if year == 2008, statistics(sum)
    .esttab, wide nonumber cell("sum(label(Total Variable2 in 2008))")
    .mat JJ = e(sum)'
    .putexcel set "name.xlsx", replace
    .putexcel A3 = "2008"
    .putexcel B3 = matrix(II)
    .putexcel C3 = matrix(JJ)

    Thank you in advance.

    David
Working...
X