Hello, I'm a new user of Stata. In my dataset variable compl_number in each row is the number of all complaints categorised by byte variables IDS, field and so on. When I use ranksum, I get the number of observations of byte variable, but not of variable compl_number. I guess the problem is in the dataset itself because the whole number of complaints is located in one cell in each row and Stata doesn't count it. What can I do in this situation?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte(IDS hosp field financ) int compl_number 1 2 5 1 65 1 1 0 1 320 1 2 1 1 82 1 2 1 2 9 1 2 1 1 2 1 2 3 1 0 1 1 1 1 160 1 1 5 1 87 1 2 1 2 27 1 2 2 1 100 1 2 0 2 15 1 1 1 1 0 1 1 2 1 80 1 1 0 2 30 1 1 3 1 300 1 1 1 2 50 1 2 4 1 0 1 1 5 2 26 1 1 4 1 3 1 1 1 2 10 1 2 0 1 95 1 2 5 2 6 2 1 0 1 542 2 2 5 1 312 2 2 1 1 63 2 1 3 1 600 2 2 2 1 280 2 1 2 2 20 2 2 3 1 2 2 2 3 2 3 2 2 0 1 280 2 1 1 1 452 2 1 3 2 120 2 1 5 1 273 2 2 1 1 248 2 1 2 1 200 end label values IDS IDS label def IDS 1 "риск прописан", modify label def IDS 2 "не прописан", modify label values hosp hosp label def hosp 1 "adult", modify label def hosp 2 "child", modify label values field field label def field 0 "не_хир", modify label def field 1 "лор_стомат", modify label def field 2 "травма", modify label def field 3 "акуш", modify label def field 4 "универ", modify label def field 5 "хирургия", modify label values financ financ label def financ 1 "госуд", modify label def financ 2 "част", modify
Code:
. by hosp, sort : ranksum compl_number, by(IDS) -------------------------------------------------------------------------------------------------- -> hosp = adult Two-sample Wilcoxon rank-sum (Mann-Whitney) test IDS | obs rank sum expected -------------+--------------------------------- риск п� | 11 81 104.5 не про� | 7 90 66.5 -------------+--------------------------------- combined | 18 171 171 -------------------------------------------------------------------------------------------------- -> hosp = child Two-sample Wilcoxon rank-sum (Mann-Whitney) test IDS | obs rank sum expected -------------+--------------------------------- риск п� | 11 86.5 104.5 не про� | 7 84.5 66.5 -------------+--------------------------------- combined | 18 171 171
Comment