Hello Statalist,
My question probably has a very simple answer, but I am stumped nonetheless. I am using the following data:
I create the following table:
I need the table to be weighted, so I follow the code presented in the Table COmmand documentation:
Why are my weighted frequencies the exact same as my unweighted ones? I cannot seem to understand what I am doing wrong. The weight variable is an integer, all variables are numeric, and when I use the tab command the weight gets applied:
I appreciate any insights into this! Thank you in advance.
My question probably has a very simple answer, but I am stumped nonetheless. I am using the following data:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int year byte prov int fweight 2017 12 134 2017 12 106 2017 10 179 2017 10 73 2017 13 91 2017 13 76 2017 12 113 2017 12 221 2017 13 172 2017 13 170 end label values prov PROV label def PROV 10 "Newfoundland and Labrador", modify label def PROV 12 "Nova Scotia", modify label def PROV 13 "New Brunswick", modify
Code:
table (year) (prov) (), statistic(freq)
-------------------------------------------------------------------------------------------------------
| Province
| Newfoundland and Labrador Prince Edward Island Nova Scotia New Brunswick Total
------------+------------------------------------------------------------------------------------------
Survey year |
2017 | 45,234 32,334 64,728 62,456 204,752
2018 | 44,905 33,317 64,792 62,108 205,122
2019 | 45,030 32,403 62,224 61,301 200,958
Total | 135,169 98,054 191,744 185,865 610,832
-------------------------------------------------------------------------------------------------------
Code:
table (year) (prov) () [fweight=fweight], statistic(freq)
-------------------------------------------------------------------------------------------------------
| Province
| Newfoundland and Labrador Prince Edward Island Nova Scotia New Brunswick Total
------------+------------------------------------------------------------------------------------------
Survey year |
2017 | 45,234 32,334 64,728 62,456 204,752
2018 | 44,905 33,317 64,792 62,108 205,122
2019 | 45,030 32,403 62,224 61,301 200,958
Total | 135,169 98,054 191,744 185,865 610,832
-------------------------------------------------------------------------------------------------------
Code:
tab year
Survey year | Freq. Percent Cum.
------------+-----------------------------------
2017 | 204,752 33.52 33.52
2018 | 205,122 33.58 67.10
2019 | 200,958 32.90 100.00
------------+-----------------------------------
Total | 610,832 100.00
. tab year [fweight=fweight]
Survey year | Freq. Percent Cum.
------------+-----------------------------------
2017 | 23,837,742 33.16 33.16
2018 | 23,944,158 33.31 66.48
2019 | 24,094,694 33.52 100.00
------------+-----------------------------------
Total | 71,876,594 100.00

Comment