Contents Publish Package Interface Previous Next

Example: Publishing with the FTP Access Method

The following example uses the FTP access method to put ODS-generated output onto the server jsmith.pc.alpair.com in the Windows operating environment. Note that the INSERT_REFERENCE CALL routine is used so that only references to the newly create HTML files are inserted into the package. Subscribers using the EMAIL transport engine will receive an e-mail message, with an embedded link to the HTML files within it.

filename myfram ftp 'odsftpf.htm'
                     host='jsmith.pc.alpair.com'
                     user='anonymous'
                     pass='smi96Gth';

filename mybody ftp 'odsftpb.htm'
                     host='jsmith.pc.alpair.com'
                     user='anonymous'
                     pass='smi96Gth';

filename mypage ftp 'odsftpp.htm'
                     host='jsmith.pc.alpair.com'
                     user='anonymous'
                     pass='smi96Gth';

filename mycont ftp 'odsftpc.htm'
                     host='jsmith.pc.alpair.com'
                     user='anonymous'
                     pass='smi96Gth';

ods listing close;
ods html frame=myfram body=mybody page=mypage contents=mycont;

title 'ODS HTML Generation to PC Files via FTP Access Method';
 data retail;
   set alpairhelp.retail;
   decade = floor(year/10) * 10;
   run;

 proc format;
  value salecol               /* maps foreground colors for total sales */
     low-1500  = 'red'
     1500-2000 = 'yellow'
     2000-high = 'green';

  value decbg                 /* gives the row labels some color */
     1980 = '#00aaaa'
     1990 = '#00cccc';

  value decfly                /* gives the decade flyovers */
     1980 = 'Me Me Me Generation'
     1990 = 'Kinder Gentler Generation';
  run;

 proc tabulate data=retail;

  class year decade;
  classlev decade / s={background=decbg. flyover=decfly.};
  classlev year   / s=<parent>;

  var sales;
  table decade * year ,
      sales *
        ( sum    * f=dollar12. * {style={foreground=salecol. font_weight=bold}}
          median * f=dollar12. * {style={foreground=black}}
        );
  run;

  data a;
    do j=1 to 5;
    do k=1 to 5;
    do i = 1 to 10;
       x=ranuni(i);
    output;end; end; end;
  run;

  proc sort data=a; by j;
  run;

  proc sort data=a; by j k;
  run;

  proc univariate; by j k; var i;
  run;

  title1;
  quit;

ods html close;

data _null_;
length desc $ 1000;
rc=0;a='a';b='b';c='c';d='d';

pid = 0;

call package_begin(pid,"Weekly Activities Report",'Type=Report', rc);
if (rc eq 0) then put 'Package begin successful.';
else do;
  msg = sysmsg();
  put msg;
end;

desc="Retail sales information as well as miscellaneous statistics
may be viewed at :";
nv="";
call insert_ref(pid, "HTML",
                "http://jsmith.pc.alpair.com/odsftpf.htm", desc, nv, rc);
if rc ne 0 then do;
   msg = sysmsg();
   put msg;
end;
else
  put 'Insert reference ok';

ldap = "LDAP://alpsrvr03.unx.alpair.com:8001/o=Alpine Airways,c=US";
channel1= 'emailonly';
subject = "Monday's Update";
properties = 'subject, channel_store';
call package_publish(pid, "TO_SUBSCRIBERS", rc, properties, subject, ldap,
                     channel1);
if rc ne 0 then do;
   msg = sysmsg();
   put msg;
end;
else
  put 'Publish successful';

call package_end(pid,rc);
if rc ne 0 then do;
   msg = sysmsg();
   put msg;
end;
else
  put 'Package term successful';

run;
quit;

Contents Publish Package Interface Previous Next