|
SAS BI Web Services
Sample PROC MEANS Using SAS BI Web ServicesThe following sample shows how to write, define, and invoke a sample stored process that can be used with SAS BI Web Services. Write the Stored ProcessThe following SAS code is a sample stored process called
%put &tablename;
libname _WEBOUT xml xmlmeta = &_XMLSCHEMA;
libname instream xml;
proc means data=instream.&tablename;
output out=_WEBOUT.mean;
run;
libname _WEBOUT clear;
libname instream clear;
Define the MetadataThe stored process must be defined in a SAS Metadata Repository that is used by SAS BI Web Services to determine how and where to run the stored process. Stored process metadata is defined using BI Manager. The tables in this section show the values for each field in BI Manager. Note: If you have previously installed the SAS Stored Process sample metadata as part of the SAS Configuration Wizard or the Web Infrastructure Kit installation, you might not need to re-create the metadata for the "Sample: MEANS Procedure Web Service" sample stored process. The sample metadata should already be available from the
Invoke the Stored ProcessSOAP RequestThe stored process we just created can be invoked by SAS BI Web Services for Java and .NET middle-tier clients. A Web service client invokes the middle-tier Web service with an Execute() command. The SOAP request body, or client code, follows:
<soap-env:Body>
<Execute>
<Command>
<StoredProcess
name="/Samples/Stored Processes/Sample:
MEANS Procedure Web Service">
<Parameter name="tablename">InData</Parameter>
<Stream name="instream">
<Table>
<InData>
<Column1>1</Column1>
<Column2>20</Column2>
<Column3>99</Column3>
</InData>
<InData>
<Column1>50</Column1>
<Column2>200</Column2>
<Column3>9999</Column3>
</InData>
<InData>
<Column1>100</Column1>
<Column2>2000</Column2>
<Column3>1000000</Column3>
</InData>
</Table>
</Stream>
</StoredProcess>
</Command>
<Properties>
<PropertyList>
<DataSourceInfo>Provider=SASSPS;</DataSourceInfo>
</PropertyList>
</Properties>
</Execute>
</soap-env:Body>
SOAP ResponseAfter you run the client code, the resulting SOAP response body is as follows:
<soap-env:Body>
<ExecuteResponse>
<return>
<root>
<TABLE>
<MEAN>
<_TYPE_> 0 </_TYPE_>
<_FREQ_> 3 </_FREQ_>
<_STAT_> N </_STAT_>
<COLUMN3> 3 </COLUMN3>
<COLUMN2> 3 </COLUMN2>
<COLUMN1> 3 </COLUMN1>
</MEAN>
<MEAN>
<_TYPE_> 0 </_TYPE_>
<_FREQ_> 3 </_FREQ_>
<_STAT_> MIN </_STAT_>
<COLUMN3> 99 </COLUMN3>
<COLUMN2> 20 </COLUMN2>
<COLUMN1> 1 </COLUMN1>
</MEAN>
<MEAN>
<_TYPE_> 0 </_TYPE_>
<_FREQ_> 3 </_FREQ_>
<_STAT_> MAX </_STAT_>
<COLUMN3> 1000000 </COLUMN3>
<COLUMN2> 2000 </COLUMN2>
<COLUMN1> 100 </COLUMN1>
</MEAN>
<MEAN>
<_TYPE_> 0 </_TYPE_>
<_FREQ_> 3 </_FREQ_>
<_STAT_> MEAN </_STAT_>
<COLUMN3> 336699.333 </COLUMN3>
<COLUMN2> 740 </COLUMN2>
<COLUMN1> 50.3333333 </COLUMN1>
</MEAN>
<MEAN>
<_TYPE_> 0 </_TYPE_>
<_FREQ_> 3 </_FREQ_>
<_STAT_> STD </_STAT_>
<COLUMN3> 574456.555 </COLUMN3>
<COLUMN2> 1094.89726 </COLUMN2>
<COLUMN1> 49.5008417 </COLUMN1>
</MEAN>
</TABLE>
</root>
</return>
</ExecuteResponse>
</soap-env>
|