I would like to calculate the average account receivable using netaccountsreceivable and lag_net_account_receivable.
However, I found the average value seems to be incorrect. For example, it is 276860608 for stkcd 1 in 1995, shouldn't it be (309246048+244475184)/2 = 276860616?
Could someone please tell me why this would happen and how to avoid that?
Thanks
code I used:
Code:
gen avg_account_receivable= (netaccountsreceivable+lag_net_account_receivable)/2
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long stkcd int year float(netaccountsreceivable lag_net_account_receivable avg_account_receivable) 1 1990 . . . 1 1991 . . . 1 1992 . . . 1 1993 . . . 1 1994 244475184 . . 1 1995 309246048 244475184 276860608 1 1996 469556608 309246048 389401344 1 1997 534341664 469556608 501949120 1 1998 516883264 534341664 525612480 1 1999 378508704 516883264 447696000 1 2000 -396003232 378508704 -8747264 1 2001 11202902 -396003232 -192400160 1 2002 -762710976 11202902 -375754048 1 2003 -833153216 -762710976 -797932096 1 2004 -874245760 -833153216 -853699456 1 2005 -763604032 -874245760 -818924928 1 2006 . -763604032 . 1 2007 . . . 1 2008 15109592064 . . 1 2009 35209261056 15109592064 25159426048 1 2010 32229515264 35209261056 33719388160 1 2011 1.84321e+11 32229515264 108275253248 1 2012 99201843200 1.84321e+11 141761413120 1 2013 1.91714e+11 99201843200 145457922048 1 2014 2.56183e+11 1.91714e+11 2.239485e+11 1 2015 3.14259e+11 2.56183e+11 2.85221e+11 1 2016 4.19846e+11 3.14259e+11 3.670525e+11 1 2017 4.25209e+11 4.19846e+11 4.225275e+11 1 2018 . 4.25209e+11 . 2 1991 142333296 . . 2 1992 125544736 142333296 133939016 2 1993 158023472 125544736 141784096 2 1994 386629024 158023472 272326240 2 1995 650885952 386629024 518757504 2 1996 691276416 650885952 671081216 2 1997 775456832 691276416 733366656 2 1998 528862240 775456832 652159552 2 1999 535368512 528862240 532115392 2 2000 516286848 535368512 525827680 2 2001 477500384 516286848 496893632 2 2002 302297120 477500384 389898752 2 2003 365968992 302297120 334133056 2 2004 838037504 365968992 602003264 2 2005 1082277376 838037504 960157440 2 2006 1035615424 1082277376 1058946432 2 2007 864883008 1035615424 950249216 2 2008 922774848 864883008 893828928 2 2009 713191936 922774848 817983360 2 2010 1594024576 713191936 1153608192 2 2011 1514813824 1594024576 1554419200 2 2012 1886548480 1514813824 1700681216 2 2013 3078969856 1886548480 2482759168 2 2014 1894071808 3078969856 2486520832 2 2015 2510653184 1894071808 2202362368 2 2016 2075256832 2510653184 2292955136 2 2017 1432733952 2075256832 1753995392 2 2018 1586180736 1432733952 1509457408 3 1991 96595616 . . 3 1992 183449968 96595616 140022784 3 1993 389976800 183449968 286713376 3 1994 533173248 389976800 461575040 3 1995 652192256 533173248 592682752 3 1996 949415296 652192256 800803776 3 1997 710684608 949415296 830049920 3 1998 566756352 710684608 638720512 3 1999 711459392 566756352 639107840 3 2000 522822464 711459392 617140928 3 2001 344030464 522822464 433426464 4 1991 18389532 . . 4 1992 53118160 18389532 35753848 4 1993 203273392 53118160 128195776 4 1994 191898672 203273392 197586032 4 1995 279380832 191898672 235639744 4 1996 118328432 279380832 198854624 4 1997 126063984 118328432 122196208 4 1998 93838936 126063984 109951456 4 1999 55299972 93838936 74569456 4 2000 222196064 55299972 138748016 4 2001 31434708 222196064 126815384 4 2002 62747196 31434708 47090952 4 2003 88416992 62747196 75582096 4 2004 98330824 88416992 93373904 4 2005 76457512 98330824 87394168 4 2006 62786196 76457512 69621856 4 2007 7229633 62786196 35007916 4 2008 4995476 7229633 6112554 4 2009 6860687 4995476 5928081 4 2010 4296549.5 6860687 5578618 4 2011 4540338 4296549.5 4418444 4 2012 8129105 4540338 6334721 4 2013 3760743 8129105 5944924 4 2014 2742071 3760743 3251407 4 2015 1726513.8 2742071 2234292.5 4 2016 1706211 1726513.8 1716362.5 4 2017 9456606 1706211 5581409 4 2018 27268320 9456606 18362464 5 1992 155349056 . . 5 1993 166755648 155349056 161052352 5 1994 200326880 166755648 183541264 5 1995 127329032 200326880 163827952 end
0 Response to Average calculation issues
Post a Comment