Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Different results while working with stata in windows and mac

    Hi All,

    I've recently started working on Stata (13.1) on a mac system, and I'm getting different results compared to a windows system; with the following syntax with which I'm trying to obtain the number of technology constructed each fiscal year

    ge recodate = date(created_on, "DMY", 2020)

    format recodate %tdDD/NN/CCYY

    sort recodate

    gen fiscal_year3 = year(recodate)

    replace fiscal_year3 = fiscal_year3 - 1 if recodate < mdy(7, 17, recodate)

    sort fiscal_year3
    by fiscal_year3: count if recodate != 0

    I was working on the ms windows earlier, and extracted the excel file from windows to mac, and now when I run stata I get two different results as below, note that the differences are only from 1999/2000

    Fiscal Year Total (Mac) Total (Windows)

    1994/95 5115 5115
    1995/96 7157 7157
    1996/97 8387 8387
    1997/98 9869 9869
    1998/99 11052 11052
    1999/00 13854 13265
    2000/01 17257 14121
    2001/02 15857 15134
    2002/03 16021 20354
    2003/04 11960 11352
    2004/05 17195 17797
    2005/06 16754 16115
    2006/07 17089 16265
    2007/08 14729 14239
    2008/09 19522 15049
    2009/10 22597 26806
    2010/11 19151 19091
    2011/12 18048 15551
    2012/13 21856 26751
    2013/14 37548 28446
    2014/15 23824 30606
    2015/16 14866 3844
    2016/17 332 13674
    2017/18
    2018/19 6288 6021
    2019/20 2617 2650
    Total 368,945 368,711

    Has it got to do with the date system with excel in mac and windows, which I dont think so, as when I convert the date systems it just adds four years to the existing dates, which gives me totally different results.

    Thank you.

  • #2
    I will note that you have a mistake in your code.
    Code:
    ge recodate = date(created_on, "DMY", 2020)
    format recodate %tdDD/NN/CCYY
    sort recodate
    gen fiscal_year3 = year(recodate)
    replace fiscal_year3 = fiscal_year3 - 1 if recodate < mdy(7, 17, recodate)
    The mdy() function takes as arguments a month number, a day number, and a year. In your second line of code, recodate is a date value, not a year.

    Comment


    • #3
      Thank you so much. Problem solved. Much appreciate.

      Comment

      Working...
      X