I am trying to plot cumulative prevalence of smoke in my dataset. It is a dichotomous outcome (1 0) across months
I have tried these codes
but not getting the right result.
Does anyone advise where I've got it wrong? Please see sample data below
Thanks,
Madu
I have tried these codes
Code:
cumul smoke, generate(c_smoke) freq line month c_smoke
Does anyone advise where I've got it wrong? Please see sample data below
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(sID month smoke) 1 7 1 2 1 0 3 4 1 4 2 0 5 6 1 6 6 1 7 7 1 8 4 1 9 2 0 10 1 . 11 6 1 12 2 0 13 4 1 14 2 0 15 7 1 16 4 1 17 1 0 18 7 1 19 6 1 20 1 0 21 7 0 22 7 0 23 6 1 24 4 0 25 4 0 26 1 0 27 2 0 28 2 0 29 1 0 30 6 1 31 6 1 32 1 . 33 7 1 34 2 0 35 1 . 36 4 1 37 2 0 38 6 1 39 7 1 40 4 1 41 7 1 42 4 1 43 7 1 44 2 . 45 6 1 46 6 1 47 1 0 48 1 0 49 4 1 50 2 . 51 1 0 52 2 0 53 4 1 54 6 1 55 7 1 56 4 1 57 6 1 58 1 0 59 7 1 60 2 0 61 1 0 62 1 0 63 2 . 64 7 0 65 4 1 66 2 . 67 4 1 68 6 1 69 6 1 70 7 0 71 2 . 72 1 . 73 6 1 74 7 . 75 4 1 76 7 1 77 7 0 78 6 0 79 2 . 80 4 1 81 1 0 82 2 0 83 1 0 84 6 1 85 4 1 86 6 1 87 1 0 88 4 1 89 7 1 90 2 0 91 7 1 92 7 0 93 6 1 94 2 . 95 4 0 96 7 0 97 1 0 98 2 . 99 6 1 100 4 0 end label values month monthlb label def monthlb 1 "1 month", modify label def monthlb 2 "2 month", modify label def monthlb 4 "4 month", modify label def monthlb 6 "6 month", modify label def monthlb 7 "7 month", modify
Madu
Comment