I am using the following command from the Stata Manual to create a descriptive table including the mean, standard deviation and correlations for my variables:
Instead of having starts to show the significance, I would like to make correlations bold if the p-value < 0.1 instead of showing significance stars.
Stata Version: 18
OS: Windows 10
Code:
sysuse auto
pwcorr price mpg rep78, sig
table (result coleq) (colname), statistic(mean price mpg rep78) statistic(sd price mpg rep78 ) command(corr=(vech(r(C))') sig=(vech(r(sig))'): pwcorr price mpg rep78, sig) nformat(%5.2f mean sd)
collect style cell result[corr], maximum(0.99, label(" - ")) nformat(%6.2f) halign(center)
collect stars sig 0.01 "***" 0.05 "**" 0.1 "*", attach(corr) shownote
collect layout (colname) (result[mean sd] coleq#result[corr])
collect style header result[corr], level(hide)
collect label levels result sd "SD", modify
collect label levels colname price "1. Price" mpg "2. Mileage" rep78 "3. Repair record 1978", modify
collect label levels coleq price "1." mpg "2." rep78 "3.", modify
collect preview
collect export CorrelationTable.docx, replace
Stata Version: 18
OS: Windows 10

Comment