I'm seeking to combine into one Excel file the results of two commands. In my complete code that follows:
1. The first command is TEFFECTS IPWRA, which can return stored results using -ESTIMATES TABLE- and -ESTTAB-.
2. The second is a post-estimation model fit test -TEBALANCE, OVERID-, which can return results using -RETURN LIST- and -PUTEXCEL-.
I've been successfully able to save the first command's results using -ESTTAB-, which only saves to *.csv Excel file format.
I've also been successful in saving the post-estimation command results using -PUTEXCEL-, which can only modify *.xlsx Excel files.
In order to modify the Excel file to add the p-value of the second command, I need to convert from *.csv to *.xlsx, but my code below returns error "file results2.csv could not be loaded" at that step. (I've confirmed correct directory, and that the file is not open.) Any advice would be appreciated.
1. The first command is TEFFECTS IPWRA, which can return stored results using -ESTIMATES TABLE- and -ESTTAB-.
2. The second is a post-estimation model fit test -TEBALANCE, OVERID-, which can return results using -RETURN LIST- and -PUTEXCEL-.
I've been successfully able to save the first command's results using -ESTTAB-, which only saves to *.csv Excel file format.
I've also been successful in saving the post-estimation command results using -PUTEXCEL-, which can only modify *.xlsx Excel files.
In order to modify the Excel file to add the p-value of the second command, I need to convert from *.csv to *.xlsx, but my code below returns error "file results2.csv could not be loaded" at that step. (I've confirmed correct directory, and that the file is not open.) Any advice would be appreciated.
Code:
clear use http://www.stata-press.com/data/r15/cattaneo2 teffects ipwra (bweight mmarried mage prenatal1 fbaby) /// (mbsmoke mmarried mage prenatal1 fbaby), pomeans estimates store model1 estimates table esttab model1 using results2.csv, b(2) se(2) r2 replace preserve clear dir import excel using results2.csv export excel using results2.xlsx, replace restore tebalance overid return list export excel putexcel set results2, modify putexcel B12=`r(p)'
Comment