Hi Patrick, Thank you for responding to my query. Yes, Because I don't have an ELSE statement the 2nd IF statement will come into effect - that's what is required. I think we can focus on this part of the code for now just to keep consistency: if '31Mar2021'd < csa_inv_dte < '01May2021'd then trademonth = '25:APR 2021'; else if '30Apr2021'd < csa_inv_dte < '01Jun2021'd then trademonth = '26:MAY 2021'; else if '31May2021'd < csa_inv_dte < '01Jul2021'd then trademonth = '27:JUN 2021'; else if '30Jun2021'd < csa_inv_dte < '01Aug2021'd then trademonth = '28:JUL 2021'; else if '31Jul2021'd < csa_inv_dte < '01Sep2021'd then trademonth = '29:AUG 2021'; else if '31Aug2021'd < csa_inv_dte < '01Oct2021'd then trademonth = '30:SEP 2021'; else if '30Sep2021'd < csa_inv_dte < '01Nov2021'd then trademonth = '31:OCT 2021'; else if '31Oct2021'd < csa_inv_dte < '01Dec2021'd then trademonth = '32:NOV 2021'; else if '30Nov2021'd < csa_inv_dte < '01Jan2022'd then trademonth = '33:DEC 2021'; else if '31Dec2021'd < csa_inv_dte < '01Feb2022'd then trademonth = '34:JAN 2022'; else if '31Jan2022'd < csa_inv_dte < '01Mar2022'd then trademonth = '35:FEB 2022'; else if '28Feb2022'd < csa_inv_dte < '01Apr2022'd then trademonth = '36:MAR 2022'; else if csa_inv_dte = . then trademonth = '99: No Inv'; So next month's code will include: if '31Mar2022'd < csa_inv_dte < '01May2022'd then trademonth = '37:APR 2022'; else but I want to automate these dates. Please let me know if I am being clear or not.
... View more