I am having difficulty with testing for trends in proportion using survey weight. I am currently using a nationally representative dataset (thus svy command) and am interested in the change of e-cigarette harm perception (relative to cigarettes) over three waves (2018, 2019, 2020). The e-cigarette harm perception variable (relative to cigarette) is nominal variable with the following option available: "less harmful", "equally harmful", "more harmful", and "don't know".
I have looked at previous discussions in Statalist. Many points to the nptrend command, however the command is for ordered variable, while the harm perception variable I am interested in have "don't know" category (thus non-ordered).
Attached below is a fraction of my dataset. I would appreciate any help on this. Thank you very much.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(Harm_2018 Harm_2019 Harm_2020 Survey_Weight Unique_ID Strata) 1 1 2 120.4 1 1 2 2 2 1231.5 2 2 3 3 3 763.2 3 3 4 4 4 234.5 4 1 1 1 1 897.4 5 2 1 1 2 435.6 6 3 2 3 3 978.4 7 1 3 3 2 605.3 8 2 4 4 3 405.6 9 3 3 3 3 309 10 1 3 3 3 980.4 11 2 1 2 3 407.7 12 3 1 2 2 902.3 13 1 2 2 2 650.4 14 2 3 3 3 900.4 15 3 4 4 4 1380.4 16 1 1 1 1 104 17 2 2 2 2 201.2 18 3 3 3 3 809.1 19 1 4 4 4 785.6 20 2 1 1 2 804.5 21 3 1 1 2 203.5 22 1 2 2 1 709.7 23 2 1 1 1 1002.1 24 3 1 1 1 840.2 25 1 1 1 2 902.5 26 2 2 2 2 500.8 27 3 1 1 1 678.2 28 1 2 2 2 809.4 29 2 2 1 1 408.5 30 3 end label values Harm_2018 Harm_2018 label def Harm_2018 1 "Less Harmful", modify label def Harm_2018 2 "Equally Harmful", modify label def Harm_2018 3 "More Harmful", modify label def Harm_2018 4 "Don't know", modify label values Harm_2019 Harm_2019 label def Harm_2019 1 "Less Harmful", modify label def Harm_2019 2 "Equally Harmful", modify label def Harm_2019 3 "More Harmful", modify label def Harm_2019 4 "Don't know", modify label values Harm_2020 Harm_2020 label def Harm_2020 1 "Less Harmful", modify label def Harm_2020 2 "Equally Harmful", modify label def Harm_2020 3 "More Harmful", modify label def Harm_2020 4 "Don't know", modify label values Strata Strata label def Strata 1 "East", modify label def Strata 2 "Central", modify label def Strata 3 "West", modify
0 Response to Help with test for trend in proportion using survey weight
Post a Comment