I getting the r(5) error "not sorted" every time couple of gen commands and later try to use "d" - first difference or "l"- lag. My data is panel data and I make sure xtset is done and also sort command is run before running "d" or. "l" command.
Just generally wondering why this is throwing an error

------------------ copy up to and including the previous line ------------------
Just generally wondering why this is throwing an error
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str9 Ticker int Year str23 Industry float(LagAssets Delta_Sales Lag_Delta_Sales CFO_SLAssets Inverse_LAssets Sales_SLAssets) "TH:2S" 1993 "Industrials" . . . . . . "TH:2S" 1994 "Industrials" . . . . . . "TH:2S" 1995 "Industrials" . . . . . . "TH:2S" 1996 "Industrials" . . . . . . "TH:2S" 1997 "Industrials" . . . . . . "TH:2S" 1998 "Industrials" . . . . . . "TH:2S" 1999 "Industrials" . . . . . . "TH:2S" 2000 "Industrials" . . . . . . "TH:2S" 2001 "Industrials" . . . . . . "TH:2S" 2002 "Industrials" . . . . . . "TH:2S" 2003 "Industrials" . . . . . . "TH:2S" 2004 "Industrials" . . . . . . "TH:2S" 2005 "Industrials" . . . . . . "TH:2S" 2006 "Industrials" . . . . . . "TH:2S" 2007 "Industrials" 626450 571220 . -.0004150371 1.5962966e-06 4.737489 "TH:2S" 2008 "Industrials" 739620 -172670 571220 .4890349 1.3520456e-06 3.779143 "TH:2S" 2009 "Industrials" 559340 -235159 -172670 -.3616566 1.7878214e-06 4.576771 "TH:2S" 2010 "Industrials" 913418 252536 -235159 -.02951989 1.094789e-06 3.079102 "TH:2S" 2011 "Industrials" 1024697 882014 252536 .08942741 9.758983e-07 3.6054766 "TH:2S" 2012 "Industrials" 1059772 364111 882014 -.05813986 9.435992e-07 3.829722 "TH:2S" 2013 "Industrials" 1253012 33404 364111 .11811858 7.98077e-07 3.26576 "TH:2S" 2014 "Industrials" 1219920 143357 33404 .08868123 8.197259e-07 3.4718614 "TH:7UP" 1993 "Resources" . . . . . . "TH:7UP" 1994 "Resources" . . . . . . "TH:7UP" 1995 "Resources" . . . . . . "TH:7UP" 1996 "Resources" . . . . . . "TH:7UP" 1997 "Resources" . . . . . . "TH:7UP" 1998 "Resources" . . . . . . "TH:7UP" 1999 "Resources" . . . . . . "TH:7UP" 2000 "Resources" . . . . . . "TH:7UP" 2001 "Resources" . . . . . . "TH:7UP" 2002 "Resources" 1239837 516562 . -.2974778 8.065576e-07 4.338902 "TH:7UP" 2003 "Resources" 1445609 -668818 516562 -.11778288 6.9175e-07 3.2586355 "TH:7UP" 2004 "Resources" 1589719 919817 -668818 .11362637 6.29042e-07 3.54184 "TH:7UP" 2005 "Resources" 2561613 4771508 919817 -.18658908 3.90379e-07 4.0607376 "TH:7UP" 2006 "Resources" 3659381 2841869 4771508 .09685026 2.7327027e-07 3.619166 "TH:7UP" 2007 "Resources" 4047774 -2839798 2841869 .13619214 2.4704937e-07 2.5703285 "TH:7UP" 2008 "Resources" 3776231 -2014388 -2839798 .04192566 2.648143e-07 2.221718 "TH:7UP" 2009 "Resources" 4178294 -2531712 -2014388 .07390121 2.3933214e-07 1.4020097 "TH:7UP" 2010 "Resources" 4126859 479308 -2531712 .04878698 2.4231502e-07 1.5356272 "TH:7UP" 2011 "Resources" 4403855 -357337 479308 .03780529 2.270738e-07 1.3578967 "TH:7UP" 2012 "Resources" 4072216 -863105 -357337 -.03156095 2.4556655e-07 1.2565333 "TH:7UP" 2013 "Resources" 1211540 -383169 -863105 .03812338 8.253958e-07 3.907181 "TH:7UP" 2014 "Resources" 1229760 -2144318 -383169 .0794399 8.131668e-07 2.1056044 "TH:A" 1993 "Property & Construction" . . . . . . "TH:A" 1994 "Property & Construction" . . . . . . "TH:A" 1995 "Property & Construction" . . . . . . "TH:A" 1996 "Property & Construction" . . . . . . "TH:A" 1997 "Property & Construction" . . . . . . "TH:A" 1998 "Property & Construction" . . . . . . "TH:A" 1999 "Property & Construction" . . . . . . "TH:A" 2000 "Property & Construction" . . . . . . "TH:A" 2001 "Property & Construction" . . . . . . "TH:A" 2002 "Property & Construction" . . . . . . "TH:A" 2003 "Property & Construction" . . . . . . "TH:A" 2004 "Property & Construction" 2060645 762735 . -.7659703 4.8528494e-07 .8610736 "TH:A" 2005 "Property & Construction" 4016429 -809923 762735 -.08021528 2.489774e-07 .24012475 "TH:A" 2006 "Property & Construction" 4277750 -97783 -809923 .016423821 2.3376775e-07 .2025974 "TH:A" 2007 "Property & Construction" 4294780 -67069 -97783 -.10706276 2.328408e-07 .18617764 "TH:A" 2008 "Property & Construction" 5084116 3939 -67069 -.0379063 1.9669103e-07 .15804733 "TH:A" 2009 "Property & Construction" 5719965 2632425 3939 .1804831 1.7482624e-07 .6006953 "TH:A" 2010 "Property & Construction" 5344282 -101860 2632425 -.01382805 1.8711587e-07 .6238623 "TH:A" 2011 "Property & Construction" 5512695 -1787209 -101860 -.03709746 1.813995e-07 .28060448 "TH:A" 2012 "Property & Construction" 5730727 231452 -1787209 -.11657352 1.7449793e-07 .3103165 "TH:A" 2013 "Property & Construction" 6866070 -15675 231452 -.26635092 1.4564372e-07 .25672096 "TH:A" 2014 "Property & Construction" 8974248 675358 -15675 -.23931888 1.1142995e-07 .27166867 "TH:A5" 1993 "Services" . . . . . . "TH:A5" 1994 "Services" . . . . . . "TH:A5" 1995 "Services" . . . . . . "TH:A5" 1996 "Services" . . . . . . "TH:A5" 1997 "Services" . . . . . . "TH:A5" 1998 "Services" . . . . . . "TH:A5" 1999 "Services" . . . . . . "TH:A5" 2000 "Services" . . . . . . "TH:A5" 2001 "Services" . . . . . . "TH:A5" 2002 "Services" . . . . . . "TH:A5" 2003 "Services" 107821 178442 . -.05895883 9.27463e-06 2.13323 "TH:A5" 2004 "Services" 243856 81778 178442 -.2026647 4.1007806e-06 1.278562 "TH:A5" 2005 "Services" 250859 -41920 81778 .027912093 3.986303e-06 1.0757637 "TH:A5" 2006 "Services" 212381 -102005 -41920 -.20266408 4.708519e-06 .790372 "TH:A5" 2007 "Services" 132642 95976 -102005 -.06907314 7.53909e-06 1.9890834 "TH:A5" 2008 "Services" 326010 6363 95976 .1095856 3.0673905e-06 .8288059 "TH:A5" 2009 "Services" 415843 41288 6363 -.218027 2.404754e-06 .7490495 "TH:A5" 2010 "Services" 179217 -155172 41288 -.3080623 5.579828e-06 .8722108 "TH:A5" 2011 "Services" 122448 256964 -155172 .1379116 8.166732e-06 3.375139 "TH:A5" 2012 "Services" 111537 -205830 256964 -.26312345 8.965635e-06 1.859912 "TH:A5" 2013 "Services" 92799 -115390 -205830 -.2658434 .000010775978 .9920258 "TH:A5" 2014 "Services" 56128 -28326 -115390 -1.3688177 .00001781642 1.1354939 "TH:AA" 1993 "Industrials" . . . . . . "TH:AA" 1994 "Industrials" 1828298 327071 . -.20037325 5.469568e-07 .28518873 "TH:AA" 1995 "Industrials" 7089493 355369 327071 -.1777663 1.410538e-07 .12367302 "TH:AA" 1996 "Industrials" 15036385 1863555 355369 -.0785168 6.650534e-08 .18224686 "TH:AA" 1997 "Industrials" 19720408 3936430 1863555 .04653114 5.070889e-08 .3385713 "TH:AA" 1998 "Industrials" 41224668 2849737 3936430 -.03786461 2.425732e-08 .2310874 "TH:AA" 1999 "Industrials" 41767512 3482412 2849737 .012057385 2.3942054e-08 .3114601 "TH:AA" 2000 "Industrials" 31661680 1953112 3482412 .09350315 3.158392e-08 .4725594 "TH:AA" 2001 "Industrials" 32022228 679058 1953112 .08127083 3.1228307e-08 .4884446 "TH:AA" 2002 "Industrials" 30030758 -874908 679058 .05350594 3.3299195e-08 .4917017 "TH:AA" 2003 "Industrials" 28927114 2963067 -874908 .04170077 3.456964e-08 .6128936 "TH:AA" 2004 "Industrials" 29620652 3051721 2963067 .11672758 3.376023e-08 .7015701 end format %ty Year
Comment