Hi Family,
I hope this message finds you well?
I am trying to put a cross tabulation for more than one variable together in one table and also in APA format using Stata17.
I tried the syntax below but still not achieving the desire format;
table (Sex) (CRS_dep), statistic(percent, across(CRS_dep)) nototals nformat(%9.2f)
table (Education) (CRS_dep), statistic(percent, across(CRS_dep)) nototals nformat(%9.2f) append
table (Mstatus) (CRS_dep), statistic(percent, across(CRS_dep)) nototals nformat(%9.2f) append
table (New_AgeGrp) (CRS_dep), statistic(percent, across(CRS_dep)) nototals nformat(%9.2f) append
table (site) (CRS_dep), statistic(percent, across(CRS_dep)) nototals nformat(%9.2f) append
collect layout (Sex Education Mstatus New_AgeGrp site) (CRS_dep)
asdoc collect preview
When I open the word document, the crosstabulation came with only percentages there was no number attached eg 23(57.6%) it only provided the percentages without the number attached.
What I want is a syntax that will generate a cross-tabulation for more than one variable that has small .'n' percentages and p-value
Below is the sample data set;
dataex Sex CRS_dep Education Mstatus New_AgeGrp
----------------------- copy starting from the next line -----------------------
I will appreciate for your help.
I hope this message finds you well?
I am trying to put a cross tabulation for more than one variable together in one table and also in APA format using Stata17.
I tried the syntax below but still not achieving the desire format;
table (Sex) (CRS_dep), statistic(percent, across(CRS_dep)) nototals nformat(%9.2f)
table (Education) (CRS_dep), statistic(percent, across(CRS_dep)) nototals nformat(%9.2f) append
table (Mstatus) (CRS_dep), statistic(percent, across(CRS_dep)) nototals nformat(%9.2f) append
table (New_AgeGrp) (CRS_dep), statistic(percent, across(CRS_dep)) nototals nformat(%9.2f) append
table (site) (CRS_dep), statistic(percent, across(CRS_dep)) nototals nformat(%9.2f) append
collect layout (Sex Education Mstatus New_AgeGrp site) (CRS_dep)
asdoc collect preview
When I open the word document, the crosstabulation came with only percentages there was no number attached eg 23(57.6%) it only provided the percentages without the number attached.
What I want is a syntax that will generate a cross-tabulation for more than one variable that has small .'n' percentages and p-value
Below is the sample data set;
dataex Sex CRS_dep Education Mstatus New_AgeGrp
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double Sex float CRS_dep double(Education Mstatus New_AgeGrp) 1 1 4 2 2 1 2 1 2 2 1 1 2 3 1 1 1 2 3 2 1 1 2 2 2 1 1 4 3 2 1 2 4 2 2 1 1 2 3 1 1 1 5 3 2 1 1 2 2 2 2 2 2 2 2 1 2 4 2 2 1 1 4 2 2 1 2 5 3 1 1 1 2 2 2 end label values Sex Sex label def Sex 1 "Male", modify label def Sex 2 "Female", modify label values CRS_dep CRS_dep label def CRS_dep 1 "Yes", modify label def CRS_dep 2 "No", modify label values Education Education label def Education 1 "Tertiary", modify label def Education 2 "SHS", modify label def Education 4 "JHS", modify label def Education 5 "Basic", modify label values Mstatus Mstatus label def Mstatus 2 "single", modify label def Mstatus 3 "married", modify label values New_AgeGrp New_AgeGrp label def New_AgeGrp 1 "Above 40years", modify label def New_AgeGrp 2 "Below 41years", modify
I will appreciate for your help.
Comment