Hello!
I am creating a table from my data, and I am running into 2 problems. Below are my code and the results:
This code gives me the following table:
This is excellent, however there are 2 problems:
Thank you very much, and apologies for the multiple questions in one post!
I am creating a table from my data, and I am running into 2 problems. Below are my code and the results:
Code:
collect clear collect layout, clear collect: table /// (var) /// (tscore), /// statistic(mean age) /// statistic(sd age) /// command(manual_pvalue = e(p): ologit tscore c.age) /// statistic(fvfrequency race) /// statistic(fvpercent race) /// command(manual_pvalue = r(p): tab race tscore, chi2) /// stars(_r_p 0.01 "***" 0.05 "**" 0.1 "*", attach(_r_b) shownote) /// noisily collect dims collect label list command, all collect addtags var[age], fortags(result[manual_pvalue]#command[1]) replace collect addtags var[race], fortags(result[manual_pvalue]#command[2]) replace collect dims collect recode result /// fvfrequency = variable_measure /// fvpercent = variable_spread /// mean = variable_measure /// sd = variable_spread // collect label levels result variable_measure "Count / Mean" variable_spread "% / (SD)" collect label levels result manual_pvalue "P-Value" collect layout /// (var) /// (tscore#result[variable_measure variable_spread] result[manual_pvalue])
This code gives me the following table:
Code:
Collection: Table Rows: var Columns: tscore#result[variable_measure variable_spread] result[manual_pvalue] Table 1: 6 x 9 -------------------------------------------------------------------------------------------------------------------------------------------------------------- | Osteoporosis (by T-Score) P-Value | Normal BMD Osteopenia Osteoporosis Total | Count / Mean % / (SD) Count / Mean % / (SD) Count / Mean % / (SD) Count / Mean % / (SD) --------------------------------------+----------------------------------------------------------------------------------------------------------------------- age | 73.67566 5.216106 75.2123 5.41293 77.31614 6.056276 74.61615 5.462809 3.22e-11 RACE/ETHNIC CATEGORY=WHITE | 532 86.9281 513 91.28114 81 93.10345 1126 89.29421 RACE/ETHNIC CATEGORY=AFRICAN AMERICAN | 61 9.96732 15 2.669039 0 0 76 6.026963 RACE/ETHNIC CATEGORY=ASIAN | 12 1.960784 20 3.558719 4 4.597701 36 2.854877 RACE/ETHNIC CATEGORY=HISPANIC | 2 .3267974 5 .8896797 1 1.149425 8 .6344171 RACE/ETHNIC CATEGORY=OTHER | 5 .8169935 9 1.601423 1 1.149425 15 1.189532 -------------------------------------------------------------------------------------------------------------------------------------------------------------- *** p<.01, ** p<.05, * p<.1
- The P-Value for race variable does not appear, eventhough the P-Value for the age variable appears. I suspect this is because collected value from the <Tab> command (via r(p) ) is automatically tagged differently than the collected value from the <ologit> command (via e(p) ). So when I attempt to add Tags, I am not adding Tags to the values Collected via <Tab> command. However I am not sure what the already assigned tags are. Regardless, can you advise how to get both P-Values to be present in the right-most column in the table?
- Also, although I have the footnote for the significance of P-Value (i.e. *** p<.01, ** p<.05, * p<.1), how can I also make sure the associated stars are put next to the appropriate P-Values under the right-most P-Value column in the table for the P-Values?
Thank you very much, and apologies for the multiple questions in one post!
Comment