Announcement

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

  • Subtracting two variables results inaccurate results

    Dear Stata listers,

    I have an issue, I want to subtract two numeric variables (Year - CEO_Age), but I get inaccurate results (diff). May you aid me to get the accurate results?




    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float Year byte CEO_Age float diff
    2010 45 1965
    2011 46 1965
    2012 48 1964
    2013 49 1964
    2014 50 1964
    2015 51 1964
    2016 52 1964
    2017 53 1964
    2018 50 1968
    2019 51 1968
    2020 52 1968
    2021 53 1968
    2011 42 1969
    2012 43 1969
    2013 30 1983
    2014 31 1983
    2015 32 1983
    2016 33 1983
    2017 34 1983
    2020 55 1965
    2021 56 1965
    2013 60 1953
    2014 61 1953
    2015 62 1953
    2016 63 1953
    2017 64 1953
    2018 65 1953
    2019 66 1953
    2020 67 1953
    2010 50 1960
    2011 51 1960
    2012 52 1960
    2013 44 1969
    2014 45 1969
    2018 58 1960
    2019 59 1960
    2020 48 1972
    2021 49 1972
    2012 55 1957
    2013 57 1956
    2015 42 1973
    2016 43 1973
    2013 50 1963
    2015 57 1958
    2016 42 1974
    2017 43 1974
    2018 44 1974
    2019 45 1974
    2020 46 1974
    2021 59 1962
    2010 51 1959
    2012 52 1960
    2013 53 1960
    2014 54 1960
    2015 55 1960
    2016 56 1960
    2017 57 1960
    2018 58 1960
    2019 59 1960
    2013 50 1963
    2014 51 1963
    2015 52 1963
    2016 53 1963
    2017 54 1963
    2018 42 1976
    2020 49 1971
    2021 50 1971
    2011 54 1957
    2012 56 1956
    2013 57 1956
    2014 58 1956
    2015 59 1956
    2016 60 1956
    2017 61 1956
    2018 53 1965
    2019 54 1965
    2020 55 1965
    2021 56 1965
    2014 50 1964
    2015 51 1964
    2017 49 1968
    2018 55 1963
    2019 56 1963
    2020 57 1963
    2021 58 1963
    2010 41 1969
    2011 42 1969
    2012 43 1969
    2013 52 1961
    2014 53 1961
    2015 54 1961
    2016 55 1961
    2017 56 1961
    2018 57 1961
    2019 58 1961
    2020 50 1970
    2021 51 1970
    2013 42 1971
    2014 43 1971
    2016 45 1971
    end
    format %ty Year

  • #2
    in what way is the result inaccurate - i.e., what do you think the answer should be?

    Comment

    Working...
    X