I'm attempting to generate ~40 sets of sample statistics, and as such would like to have Stata output the name of each series into excel. My current code looks like this:
Where each of PEER1_PV_PS PEER1_PV_PE PEER1_PV_EVEBITDA PEER1_PV_EVEBIT are series (of which there are at ~40 of), and the sections in green are those which I'm having issues with.
The current output looks like this: Array
The output I want looks like this: Array
Thanks in advance!
Code:
//INPUTS local Peer1 PEER1_PV_PS PEER1_PV_PE PEER1_PV_EVEBITDA PEER1_PV_EVEBIT local ncol = 2 local nrow = 2 //LOOP local col1: word `ncol' of `c(ALPHA)' local ++ncol foreach var in `Peer1'{ local name1 `var' summarize `var', detail separator(0) local col: word `ncol' of `c(ALPHA)' putexcel `col'`nrow'=(`name1') `col1'`nrow'=rscalarnames `col'`nrow'=rscalars using"V:\SummaryStats.xlsx", modify local ++ncol }
The current output looks like this: Array
The output I want looks like this: Array
Thanks in advance!