There is the solution. To delete packages from specifically named folders on the channel using report dates and some delay interval (15 days) . For example, when report as of 28 jan is being published, then report as of 13 jan is being deleted
Not the best algorythm, but it works
ODS _ALL_ CLOSE;
/* Diagnostic function */
%macro chkrc(function);
%if &rc = 0 %then %put "NOTE: &function succeeded.";
%else %do;
%let msg = %sysfunc(sysmsg());
%put &function failed - &msg;
%end;
%mend;
/* package preamble */
%let package_options = ABSTRACT;
%let pid = 0;
%let rc = 0;
%let namevalue=;
%let abstract_text= %nrbquote(Published by Finance);
%let description = %nrbquote(Corporate Loans &Repdate);
%syscall package_begin(pid, description, namevalue, rc, package_options, abstract_text);
%chkrc(Package Begin);
filename b 'Corp_portf.html';
%let description = %nrbquote(Corporate Loans &Repdate);
%let namevalue = ;
%let body = %nrbquote(fileref:b);
%let frame=;
%let contents=;
%let pages=;
%let burl=body0.html;
%let curl=;
%let furl=;
%let purl=;
%syscall insert_html(pid, body, burl, frame, furl, contents, curl, pages, purl, description, namevalue, rc);
%chkrc(Insert Html);
/* Publish the package */
%let pubType = TO_SUBSCRIBERS;
%let pub_properties = CHANNEL_STORE, COLLECTION_URL, METAUSER, METAPASS;
%let channelURI = %nrbquote(SAS-OMA://10.1.50.53:8561/reposname=Foundation);
%let channel = %nrbquote(FINANCE GENERAL);
%let url =
http://SASMID:8300/sasdav/fgeneral/CP&Repdate;
%let muser = %nrbquote(Usrername);
%let mpass = %nrbquote(********);
%syscall package_publish(pid, pubType, rc, pub_properties, channelURI, url, muser, mpass, channel);
%chkrc(package publish);
proc sql noprint;
connect to oracle
(user=userid orapw="********" path='owh.world');
create table week_day_day as
select * from connection to oracle
( select to_date(%bquote('&Repdate'),'dd.mm.yyyy') - 15 del_date from dual
);
disconnect from oracle;
quit;
proc sql noprint;
select datepart(w.del_date) format = rusdfdd10. into :del_date from work.week_day_day w;
quit;
%let plist=0;
%let retType = FROM_WEBDAV;
%let url =
http://SASMID:8300/sasdav/fgeneral/CP&del_date;
%let rc=0;
%let total=0;
%syscall RETRIEVE_PACKAGE(plist,retType, url, total, rc);
%chkrc(retrieve nested);
%let packageId = 0;
%let desc='';
%let num=0;
%let dt=0;
%let nv='';
%let ch='';
%let rc=0;
%syscall PACKAGE_FIRST(plist, packageId,
num, desc, dt, nv, ch, rc);
%chkrc(package first);
%syscall package_destroy(packageId,rc);