This example illustrates how to create a simple stored process and execute it as a RESTful SAS BI web service. The output is returned to the client as package output.
Example:
Stream input: XML
Package output: HTML and graph (or modify to create a PDF or Microsoft Excel file)
In this example, XML input is sent to the stored process. HTML and graph output is sent back to the client application.
You can modify the code to create PDF output or Excel output.
libname instream xml;
/* Read the XML input stream. */
/* The name of the input table is CLASS. */
proc copy in=instream out=work;
run;
/* By default, HTML output will be created. */
/* Uncomment the next line to create PDF output. */
/* %let _odsdest=pdf; */
/* Uncomment the next line to create Excel output. */
/* %let _odsdest=excel; */
%stpbegin;
proc print data=work.class;
run;
proc gchart data=work.class;
vbar age / discrete;
run;
%stpend(debug=1);
/* The log file contains information about the files that were inserted in the package.*/
More Information
For more information, see the following:
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
filename input TEMP;
data _null_;
file input;
input rec $80.;
put rec;
/* NOTE: All of the input lines below should begin in column 1. */
cards4;
<upload_stream>
<streams>
<instream>
<Value>
<TABLE>
<CLASS>
<Name> Alfred </Name>
<Age> 14 </Age>
</CLASS>
<CLASS>
<Name> Alice </Name>
<Age> 13 </Age>
</CLASS>
<CLASS>
<Name> Barbara </Name>
<Age> 13 </Age>
</CLASS>
<CLASS>
<Name> Carol </Name>
<Age> 14 </Age>
</CLASS>
<CLASS>
<Name> Henry </Name>
<Age> 14 </Age>
</CLASS>
<CLASS>
<Name> James </Name>
<Age> 12 </Age>
</CLASS>
</TABLE>
</Value>
</instream>
</streams>
</upload_stream>
;;;;
/* Get the graph output file. It is the first file in the package. */
/* NOTE: "packageEntries/0" in the URL will retrieve the first file in the package. */
filename resp "c:\temp\gchart.png";
proc http
url="http://host-name:port/SASBIWS/rest/storedProcesses/Examples/web_service_test7/packageEntries/0"
in=input
out=resp;
headers "Content-Type"="application/xml" "Accept"="text/html";
run;
/* Get the HTML output file. It is the second file in the package. */
/* NOTE: "packageEntries/1" in the URL will retrieve the second file in the package. */
filename resp2 "c:\temp\test.html";
proc http
url="http://host-name:port/SASBIWS/rest/storedProcesses/Examples/web_service_test7/packageEntries/1"
in=input
out=resp2;
headers "Content-Type"="application/xml" "Accept"="text/html";
run;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Date Modified: | 2019-01-14 10:41:49 |
Date Created: | 2019-01-09 10:29:06 |
Product Family | Product | Host | Product Release | SAS Release | ||
Starting | Ending | Starting | Ending | |||
SAS System | SAS Integration Technologies | Microsoft® Windows® for x64 | 9.4_M5 | 9.4 TS1M5 | ||
Microsoft Windows 8 Enterprise 32-bit | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows 8 Enterprise x64 | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows 8 Pro 32-bit | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows 8 Pro x64 | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows 8.1 Enterprise 32-bit | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows 8.1 Enterprise x64 | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows 8.1 Pro 32-bit | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows 8.1 Pro x64 | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows 10 | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows Server 2008 | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows Server 2008 R2 | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows Server 2008 for x64 | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows Server 2012 Datacenter | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows Server 2012 R2 Datacenter | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows Server 2012 R2 Std | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows Server 2012 Std | 9.4_M5 | 9.4 TS1M5 | ||||
Microsoft Windows Server 2016 | 9.4_M5 | 9.4 TS1M5 | ||||
Windows 7 Enterprise 32 bit | 9.4_M5 | 9.4 TS1M5 | ||||
Windows 7 Enterprise x64 | 9.4_M5 | 9.4 TS1M5 | ||||
Windows 7 Home Premium 32 bit | 9.4_M5 | 9.4 TS1M5 | ||||
Windows 7 Home Premium x64 | 9.4_M5 | 9.4 TS1M5 | ||||
Windows 7 Professional 32 bit | 9.4_M5 | 9.4 TS1M5 | ||||
Windows 7 Professional x64 | 9.4_M5 | 9.4 TS1M5 | ||||
Windows 7 Ultimate 32 bit | 9.4_M5 | 9.4 TS1M5 | ||||
Windows 7 Ultimate x64 | 9.4_M5 | 9.4 TS1M5 | ||||
64-bit Enabled AIX | 9.4_M5 | 9.4 TS1M5 | ||||
64-bit Enabled Solaris | 9.4_M5 | 9.4 TS1M5 | ||||
HP-UX IPF | 9.4_M5 | 9.4 TS1M5 | ||||
Linux for x64 | 9.4_M5 | 9.4 TS1M5 | ||||
Solaris for x64 | 9.4_M5 | 9.4 TS1M5 |