When using Nested INTNX to add a Month and a Day to a Date variable, the outputs differ in a way that is unexpected. These two scenarios result in different Date Values: (1). Take a Date Value and then Subtract a Month from it and then Add 9 days to it. (2). Take the same Date Value and then Add 9 days to it and then Subtract a Month from it. Please explain why there is a difference between the results of the 2 above cases using the specific code provided below. This is the code I am struggling with: Data Test; birthd='20180901'; date_new = input(birthd, yymmdd8.); date_new2 = INTNX('MONTH' ,date_new, -1); date_new3 = INTNX('DAY', INTNX('MONTH' ,date_new, -1), 9) ; date_new4 = INTNX('DAY' ,date_new, 10); date_new5 = INTNX('MONTH', INTNX('DAY' ,date_new, 9), -1) ; format date_new yymmdd10.; format date_new2 yymmdd10.; format date_new3 yymmdd10.; format date_new4 yymmdd10.; format date_new5 yymmdd10.; Run; OUTPUT: ============ birthd date_new date_new2 date_new3 date_new4 date_new5 20180901 2018-09-01 2018-08-01 2018-08-10 2018-09-11 2018-08-01 The fact that the Variables date_new3 and date_new5 have different values is perplexing. ** Using Version 7.15 of SAS Enterprise Guide *** I come from a programming background experienced in C#, JAVA, C, VB.NET, JavaScript, VBA etc. But I am very new to the nuances of the Base SAS programming language Syntax which is SO VERY DIFFERENT! Please Help!!!
... View more