Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73038

Restrict decimal places in -tabstat results exported to Excel via -putexcel

$
0
0
I want to export a lot of descriptive statistics produced via -tabstat to Excel via -putexcel. I am working on a remote server which is not too happy about exporting results containing 16 digits to my PC. Therefore I need to restrict the number of decimals which are in the resulting excelfile. It seems, that using the format() option in -tabstat only restricts the decimal places in the Stata output, but not in the results which are exported to Excel:

Code:
putexcel set test, modify
sysuse auto
tabstat weight gear_ratio turn, by(rep78) save format(%9.1f)
forval x = 1/5{
    putexcel b`x'=matrix(r(Stat`x'))
}
How can I restric the number of decimals in the Excel results? The remote server won't let me modify anything in Excel using Excel, i.e., I need to do it all via the Stata commands. In my real data I have 43 variables, 4 descriptive statistics for 5 subgroups, so I am not sure that storing the results in new variables (43*4*5=860) with numbers rounded to 3 decimal places are effecient.

Viewing all articles
Browse latest Browse all 73038

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>