Hi,
I'm using putexcel to export a matrix I created storing a number of results. I have given names to the columns and rows of the matrix, but the putexcel command is only saving the content of the matrix (not the column and row names). If I list the matrix, it includes the row and column names, so they are specified correctly. I tried specifying rownames and colnames options, but it returns an error message (eg option colnames not allowed). I see from your description above that I can add the row and column names manually specifying each one (eg B1=("Population")) Is there any way I could export those row and column names automatically?
Here is an example of the code that causes the error, using a simplified matrix:
version 14
foreach V of var ipd sero_7{
matrix ci1_`V'=J(1,5,-99)
matrix colnames ci1_`V'= Population IncidenceRate StdErr 95Lower 95Upper
matrix rownames ci1_`V'=0-4_2009
quietly ci `V' if year==2009 & age_code_2==1, poisson exposure(population)
matrix ci1_`V'[1,1]=r(N)
matrix ci1_`V'[1,2]=r(mean)
matrix ci1_`V'[1,3]=r(se)
matrix ci1_`V'[1,4]=r(lb)
matrix ci1_`V'[1,5]=r(ub)
matrix list ci1_`V'
putexcel set ipd_results, modify sheet("`V'",replace)
putexcel B2 = matrix(ci1_`V') , colnames
}
I'd appreciate your help!