Hi Family,
I have three(3) variables that I have run crosstabulation and append them in one table, using the coded below;
But after running the table, I realized the percentage is in 5 decimal places but I rather need the final percentage in to 2decimal places rather.
table (agegp) (dep_var), statistic(percent, across(dep_var)) nototals
table (mstatus) (dep_var), statistic(percent, across(dep_var)) nototals append
table (ternue) (dep_var), statistic(percent, across(dep_var)) nototals append
collect layout (agegp mstatus ternue) (dep_var)
Any help?
. dataex dep_var agegp ternue mstatus
----------------------- copy starting from the next line -----------------------
Thank you.
I have three(3) variables that I have run crosstabulation and append them in one table, using the coded below;
But after running the table, I realized the percentage is in 5 decimal places but I rather need the final percentage in to 2decimal places rather.
table (agegp) (dep_var), statistic(percent, across(dep_var)) nototals
table (mstatus) (dep_var), statistic(percent, across(dep_var)) nototals append
table (ternue) (dep_var), statistic(percent, across(dep_var)) nototals append
collect layout (agegp mstatus ternue) (dep_var)
Any help?
. dataex dep_var agegp ternue mstatus
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float dep_var int agegp byte(ternue mstatus) 1 1 3 3 1 2 3 1 1 2 3 1 0 2 3 1 1 2 3 1 1 1 3 3 1 4 3 2 1 2 3 1 1 1 3 3 1 1 3 3 1 4 3 2 1 2 3 1 1 1 3 3 1 1 3 1 1 1 3 1 1 1 1 1 1 4 3 2 1 1 3 1 1 2 3 1 0 2 3 1 end label values dep_var dep_var label def dep_var 0 "mild anxiety", modify label def dep_var 1 "severe anxiety", modify label values agegp agegp label def agegp 1 "18-30", modify label def agegp 2 "31-45", modify label def agegp 4 "61+", modify label values ternue ternue label def ternue 1 "Rent (Private, Social housing)", modify label def ternue 3 "Other (living family and friends, holiday)", modify label values mstatus mstatus label def mstatus 1 "In union (living with partner and married)", modify label def mstatus 2 "Formerly in union (divorced, widowed)", modify label def mstatus 3 "Never Married (Single)", modify
Thank you.
Comment