Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Missing cases after contract with large weight


From   "Scott Merryman" <[email protected]>
To   [email protected]
Subject   Re: st: Missing cases after contract with large weight
Date   Thu, 20 Dec 2007 15:48:30 -0600

Looks like if you change storage type in line 93 from long to double
(and save it under a different name):

	qui by `varlist' : gen double `freq' = sum(`expvar')

.  sysuse auto, clear
(1978 Automobile Data)

.  replace weight = weight * 100000
weight was int now long
(74 real changes made)

.  tab rep78 [fw=weight], m

     Repair |
Record 1978 |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |620,000,000        2.77        2.77
          2 | 2683000000       12.01       14.78
          3 | 9897000000       44.29       59.08
          4 | 5166000000       23.12       82.20
          5 | 2555000000       11.43       93.63
          . | 1423000000        6.37      100.00
------------+-----------------------------------
      Total |22344000000      100.00

.  mycontract rep78 [fw=weight]

.         format _f %20.0g

. clist

        rep78                 _freq
  1.        1             620000000
  2.        2            2683000000
  3.        3            9897000000
  4.        4            5166000000
  5.        5            2555000000
  6.        .            1423000000


Scott


On Dec 20, 2007 3:32 PM, Friedrich Huebler <[email protected]> wrote:
> I discovered that -contract- drops observations when a weight with
> large numbers is used. What is the explanation for this and is
> -contract- designed to work this way?
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index