I want to use sum to get a weighted count of observations. I can weight sum, but the memory, r(N), is unweighted. How can I get a memory of a weighted count?
-
Login or Register
- Log in with
. sysuse auto, clear (1978 Automobile Data) . count 74 . gen wt = rpoisson(3) . summ price [fweight = wt] Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- price | 214 5839.346 2643.194 3291 15906 . return list scalars: r(N) = 214 r(sum_w) = 214 r(mean) = 5839.345794392523 r(Var) = 6986474.85639068 r(sd) = 2643.194063323895 r(min) = 3291 r(max) = 15906 r(sum) = 1249620 .
Comment