Hi @yabwon, Thank you for sharing a sample code. I should have mentioned it before that the difference isn't one. Though i know that in my last post i had mentioned 2019-05-10 to 2019-11-10, but it's not exactly with of equal difference(-1) between folders. The difference varies. i understand the statement %let dt=%sysfunc(intnx(month, &start.,%eval(&i. - 1) ,S), yymmdd10.); will only work when difference of folders are only a month. So, any other way of dealing this if the difference between folders not consistent,unlike 1 month as assumed? And it throws error when the library names generated from the statement libname lib&i "C:\my_folder\my_subfolder\&dt."; is taken for any further proc process. eg: instead of C:\my_folder\my_subfolder\ the sample i have is "\\XXX-sas-zz1\my_folder\sub_folder. So when i use a procedure proc sort data=lib.&i;by PatientInitials;run; it throws error as i have \\XXX-sas-zz1 and due to the "-" delimiters sas is unable to recognize the path and throws error.
... View more