Hello, I want to add a p-value column to this table where the p-value from relevant tests (i.e., for 'age' from t-test and for 'gender' and 'course' from chi-square test) will be displayed. What is the way to do it?
The code I used was:
Thank you!
Code:
-----------------------------------------
Substance Use
No Yes
-----------------------------------------
Age 22.1 (1.9) 23.6 (2.1)
Gender
Male 413 (42.4%) 126 (81.8%)
Female 562 (57.6%) 28 (18.2%)
Course
MBBS 922 (94.6%) 146 (94.8%)
BDS 53 (5.4%) 8 (5.2%)
-----------------------------------------
Code:
table (var) (substanceuse), statistic(mean age) statist (sd age) statistic(fvfrequency gender curriculum ) statistic(fvpercent gender curriculum ) nototals
collect recode result mean = column1 sd=column2 fvfrequency = column1 fvpercent = column2
collect layout (var) (substanceuse#result[column1 column2])
collect style cell var[gender curriculum ]#result[column1], nformat(%6.0fc)
collect style cell var[gender curriculum ]#result[column2], nformat(%6.1f) sformat("(%s%%)")
collect style cell var[age]#result[column1 column2], nformat(%6.1f)
collect style cell var[age]#result[column2], sformat("(%s)")
collect style header result, level(hide)
collect style row stack, nobinder spacer
collect style cell border_block, border(right, pattern(nil))
collect preview

Comment