SAS 9.1.3 Integration Technologies » Developer's Guide


Publish Package Interface
Publish/Retrieve Encoding Behavior
Publishing Packages
INSERT_CATALOG
INSERT_DATASET
INSERT_FDB
INSERT_FILE
INSERT_HTML
INSERT_MDDB
INSERT_PACKAGE
INSERT_REF
INSERT_SQLVIEW
INSERT_VIEWER
PACKAGE_BEGIN
PACKAGE_END
PACKAGE_PUBLISH
LDAP Channel Store Syntax
SAS Metadata Repository Channel Store Syntax
Retrieving Packages
COMPANION_NEXT
ENTRY_FIRST
ENTRY_NEXT
PACKAGE_DESTROY
PACKAGE_FIRST
PACKAGE_NEXT
PACKAGE_TERM
RETRIEVE_CATALOG
RETRIEVE_DATASET
RETRIEVE_FDB
RETRIEVE_FILE
RETRIEVE_HTML
RETRIEVE_MDDB
RETRIEVE_NESTED
RETRIEVE_PACKAGE
RETRIEVE_REF
RETRIEVE_SQLVIEW
RETRIEVE_VIEWER
Filtering Packages
Publishing Examples
Publishing in the Data Step
Publishing in a Macro
Publishing with FTP
Publishing Framework

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;
      /* maps foreground colors for total sales */
      value salecol               
         low-1500  = 'red'
         1500-2000 = 'yellow'
         2000-high = 'green';

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

      /* gives the decade flyovers */
      value decfly                
         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 and miscellaneous 
      statistics 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=Alphalite 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;