Hi,

I have two variables for which I use the sum command to aggregate the values, so I end-up with two numbers. I want to export these two results so I use the matrix function. I also want to divide these two results together and export the result too. It is here that I have a problem. 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

I have two variables for which I use the sum command to aggregate the values, so I end-up with two numbers. I want to export these two results so I use the matrix function. I also want to divide these two results together and export the result too. It is here that I have a problem. 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

## Comment