I am subtracting two dates in sas using the YRdiff function but I am not getting same result as excel using the yearfrac function. My expected result in the expect column. Also, intck function gives me the integer number.
I need help. Thanks in advance.
data test;
input date1 date2 expected_result;
informat date1 date2 yymmdd10.;
format date1 date2 yymmdd10.;
cards;
2018/10/31 2022/07/15 3.708333333
2018/10/31 2020/04/15 1.458333333
2018/10/31 2020/04/15 1.458333333
2018/10/31 2021/01/15 2.208333333
2018/10/31 2019/09/16 0.877777778
2018/10/31 2022/04/18 3.466666667
2018/10/31 2020/04/15 1.458333333
2018/10/31 2019/02/19 0.302777778
2018/10/31 2019/01/15 0.208333333
2018/10/31 2021/01/15 2.208333333
2018/10/31 2021/05/17 2.547222222
2018/10/31 2023/08/15 4.791666667
2018/10/31 2021/04/15 2.458333333
2018/10/31 2020/04/15 1.458333333
2018/10/31 2022/07/15 3.708333333
2018/10/31 2021/04/15 2.458333333
2018/10/31 2019/02/19 0.302777778
2018/10/31 2023/08/15 4.791666667
2018/10/31 2019/09/16 0.877777778
2018/10/31 2021/05/17 2.547222222
2018/10/31 2022/04/18 3.466666667
2018/10/31 2019/01/15 0.208333333
;
run;