As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Publishing ODS output as a PDF to a webDAV server

From sasCommunity
Jump to: navigation, search

This example shows how to use a SAS Stored Process to publish some ODS output as a PDF file to a webDAV server, which is not a well documented process. The 9.2 Business Intelligence Platform includes a webDAV server, and this will be our destination. Once published to the webDAV server, files can be displayed in the SAS Information Delivery Portal. The stored process in this example can be displayed in either the Portal or the SAS Stored Process web application.


Enterprise Guide 4.2 was used to create a new stored process and define its input parameters. Some of the parameters are hidden so that they will not appear as prompts to the user when the user executes the stored process. Alternatively, those hidden parameters could be defined within the code of the SAS program. This example prompts the user to specify the name of a column in a table of oxygen demand that will serve as the X axis of a graph. The selected column will be the independent variable in the graph showing the logarithm of oxygen uptake in freshwater. The data were obtained earlier by running a SAS program where the FILENAME statement with the URL option pointed to this file. The resulting SAS table was registered in metadata so that the stored process could access it via the “meta” option of the LIBNAME statement. The key elements of the SAS program are in the definition of reserved macro variables needed by the publishing framework and in the ODS statement. Documentation of the macro variables is at Here is the explanation of the values we specified for certain macro variables.

  • _COLLECTION_URL is the URL of the SAS Content Server (webDAV). For example, will put files into the folder of the “sasdemo” user.
  • _HTTP_PASSWORD supplies the password for security credentials.
  • _HTTP_USER supplies the userid for security credentials.
  • _NAMEVALUE supplies the file name for the PDF.
  • _RESULT with a value of PACKAGE_TO_WEBDAV says that a package will be published to webDAV.
  • _IF_EXISTS with a value equal to UPDATE will prevent the publishing framework from deleting all files in the destination folder and removing any subfolders.

The _ODSDEST macro variable is assigned the value of “none”. The ODS statement defines the destination as “PDF” and supplies a file option where the macro variables _STPWORK and _NAMEVALUE are combined to define the temporary file name. The publishing framework will put the temporary PDF file permanently into the SAS Content Server.

The SAS Stored Process program

*  Begin EG generated code (do not edit this line);
*  Stored process registered by
*  Enterprise Guide Stored Process Manager V4.2
*  ====================================================================
*  Stored process name: Oxygen Demand Graphing
*  Description: graph of oxygen demand
*  ====================================================================
*  Stored process prompt dictionary:
*  ____________________________________
*       Type: Text
*      Label: _COLLECTION_URL
*       Attr: Hidden
*    Default: 
* http://d20920:8080/SASContentServer/repository/default/sasdav/Users/sasdemo/pdfs
*  ____________________________________
*       Type: Text
*      Label: _HTTP_PASSWORD
*       Attr: Hidden
*    Default: XXXXXX
*  ____________________________________
*       Type: Text
*      Label: _HTTP_USER
*       Attr: Hidden
*    Default: D20920\sasdemo
*  ____________________________________
*       Type: Text
*      Label: name value
*       Attr: Hidden, Fixed
*    Default: Oxygen.pdf
*       Desc: the name of the output pdf file.
*  ____________________________________
*       Type: Text
*      Label: _RESULT
*       Attr: Hidden
*  ____________________________________
*       Type: Text
*      Label: New data rows?
*       Attr: Visible
*  ____________________________________
*  X
*       Type: Text
*      Label: x axis
*       Attr: Visible, Required
*       Desc: Independent variable
*  ____________________________________
%let _ODSDEST=none;
*  End EG generated code (do not edit this line);
%macro plot;
%if &newdata=true %then %do; /*only plot if new data rows are available */
ods pdf file="&_STPWORK&_NAMEVALUE" style=&_ODSSTYLE;
goptions device=&_GOPT_DEVICE;
ods listing close;
ods graphics;
libname metalib meta library=spDataSets;
proc gplot data= metalib.oxygen;
plot logo2up * &x;
title "Log Oxygen Uptake";
ods graphics off;
ods listing;
title '';
%mend plot;
*  Begin EG generated code (do not edit this line);
*  End EG generated code (do not edit this line);