Everyday a job runs and it creates a dataset with date extension in the library called final. For example date extension for the first record read this 2018 is the year, 05 is the month and 04 is the day which is yymmddn8. date format Sample_20180504 Sample_20180503 Sample_20180502 Sample_20180501 Sample_20180430 Sample_20180429 Sample_20180428 I want to create a macro or code which will delete the tables or dataset in the final library which has file extension more than 3 days old. In the above example all the dataset older than 2nd May 2018 extension should be deleted if I run it today which is 4th May 2018 I tried the code but it did not work out data _null_; call symput('to_delete',catt('sample_',year(today())-0, put(intnx('day',today(),-3), z2.))); run; Similarly you can put for month but it only deletes one record which is less than 3 that is Sample_20180501. I want to delete all that are older than 3 days old which is till 28th april 2018 record
... View more