Code:
* Example generated by -dataex-. For more info, type help dataex clear input int participant_ID byte(age gender education) float amphetamines_past30m 180 52 2 3 0 38 67 2 4 0 266 63 1 4 1 184 55 2 2 0 32 65 1 1 0 190 52 2 1 1 244 68 2 3 0 303 55 1 2 0 211 62 2 1 0 196 60 1 2 0 174 46 2 4 0 51 57 2 3 0 52 35 2 2 0 309 36 1 2 1 127 53 1 3 0 59 60 2 3 0 94 60 2 3 0 274 58 1 4 0 246 43 2 2 1 67 65 2 1 1 6 59 2 2 0 187 60 1 1 1 258 73 2 3 0 42 59 2 2 0 96 59 1 1 0 69 67 2 2 0 end
Code:
dtable c.age i.gender c.education, by(amphetamines_past30m, nototals tests) sample(, statistics(freq) place(seplabels)) sformat("(N=%s)" frequency) note(Total sample: N = 344) nformat(%7.2f mean sd) title(Table 1. Demographics) export(table1.xlsx, replace)