BookmarkSubscribeRSS Feed
igor_protas
Calcite | Level 5
hi,

does anyone know the alternative to Package Cleanup Utility ( which is available in SAS 9.2 version only) for SAS 9.1.3.

http://support.sas.com/documentation/cdl/en/biwaag/63149/HTML/default/viewer.htm#a003311141.htm

There is a need to delete automatically most recent packages from publication channels. Message was edited by: igor_protas
1 REPLY 1
igor_protas
Calcite | Level 5
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);

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 916 views
  • 0 likes
  • 1 in conversation