|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.servlet.tbeans.webmddbview.WebMDDBView
public class WebMDDBView
The experimental WEBMDDB procedure reads a SAS data set, constructs a multidimensional database (MDDB) to summarize the input data, and then uses the MDDB to write out a data file. A JavaServer page (JSP) interprets the data file and displays a tabular report in a Web browser. You can design the Web report so that users can expand and drill down into report elements.
In order to produce a WEBMDDB report, you perform the following two tasks:
For information about how to perform these tasks, see the following topics:
Note: The software functions only if your site licenses SAS/MDDB® Server Software.
See also:
The procedure syntax consists of the following elements:
Here are the required arguments for the PROC WEBMDDB statement:
Tip: | Remember to include a LIBNAME statement to assign the libref. |
Note: See File Naming Guidelines for recommendations about how to name the SAS, JSP, and WEBMDDB files.
The PROC WEBMDDB statement has one option:
'_none_'
.
Default: | WEBMDDB Report |
The following example includes LIBNAME, FILENAME, and PROC WEBMDDB statements:
libname sashelp 'c:\program files\sas\v8'; filename class 'class.webmddb'; proc webmddb data=sashelp.class out=class jsp='class.jsp' caption='Student Population Report';
The MEASURE statement defines the columns that are summarized in the
report. For each MEASURE statement, you specify one variable and one statistic using the form variable_statistic. For example, to derive the sum of a variable named amount
, you specify amount_sum
. The available statistics are N, SUM, AVG, NMISS, SUMWGT, MIN, MAX, USS, UWSUM, RANGE, CSS, VAR, STD, STDERR, CV, T, PRT, LCLM, UCLM, PCTSUM, and PCTN.
Note: For more information about the statistics, see "SAS Elementary Statistics Procedures" in Base SAS Procedures Guide.
The MEASURE statement has the following options:
format<w>.<d>
that is applied to the measure value. For example, in FORMAT=DOLLAR10.2
, the w
value of 10
specifies a maximum of 10 columns for the value. The d
value of 2
specifies that two of these columns are for the decimal part of the value, which leaves eight columns for all the remaining characters in the value. This includes the decimal point, the remaining numeric value, a minus sign if the value is negative, the dollar sign, and commas, if any. Requirement: | This option is required for weighted statistics. |
Default: | The variable name plus the statistic name. For example, if the variable is named amount and the statistic is SUM, then the default column header is AMOUNT SUM .
|
If you do not specify a format (using either FORMAT=, PRECISION=, or SCALE=), PROC WEBMDDB applies a format to the measure according to the following rules:
Insert a forward slash / before listing the options. The following MEASURE statement example uses FORMAT= and CAPTION= options.
measure weight_avg / format=COMMA8.4 caption='Avg Weight';
The DIMENSION statement lists the classification variables that are displayed in the report. This statement also sets the drill-down hierarchy for the table in the primary report; for this reason, you must order the classification variables to follow a logical drill-down path into the MDDB. The first classification variable listed is the top level in the table and the subsequent classification variables are the lower levels.
The JSP file includes code that enables users to click each classification variable in the table to display the values of the next variable. When the user reaches the lowest classification variable in the dimension, the detail report is displayed in a new browser window. (See The DETAIL Statement for information about how to specify what information is included in the detail report.)
Note: You can have only one DIMENSION statement per WEBMDDB report.
By default, all classification variables are sorted in ascending order. To specify a different order, enter one of the following keywords after you specify the classification variable name:
In the following example, the classification variable age
is sorted in descending order, and the classification variable sex
uses the default ascending order.
dimension age descending sex / caption='Age .. Sex';
The DIMENSION statement has one option:
Default: | Column header is left blank. |
The DETAIL statement lists the variables in the input data set that are displayed in a detail report after you click on the lowest classification variable in the dimension. The detail report, which opens in a separate browser window, displays data for the items that make up one row of the lowest level in the dimension. Variable labels from the input data set are used as column headers.
For example, you could create a primary report that shows sales prospects by region, category, and
product. A manager could expand the report down to the product classification variable in the school supplies category of the western region. He could then select the product
link in the table to display a list of customers who are interested in notebooks and organizers in that area.
The DETAIL statement has one option:
'_none_'
.
Default: | WEBMDDB Detail Report |
detail age sex name height weight / caption='Population Detail Report';
The following PROC WEBMDDB example code builds a report from a data set named SASHELP.CLASS.
libname sashelp 'c:\program files\sas\v8'; filename class 'class.webmddb'; proc webmddb data=sashelp.class out=class jsp='class.jsp' caption='Student Population Report'; measure height_min / caption='Min Height'; measure height_avg / caption='Avg Height'; measure height_max / caption='Max Height'; measure weight_min / caption='Min Weight'; measure weight_avg / caption='Avg Weight'; measure weight_max / caption='Max Weight'; dimension age sex / caption='Age .. Sex'; detail age sex name height weight / caption='Population Detail Report'; run;
Each WEBMDDB report requires an associated JSP file. The JSP file contains the code that enables users to expand and drill down into the report. You name the file with the JSP= argument on the PROC WEBMDDB statement.
Cut and paste the following sample code into your JSP file. To customize the file for your report, change the following items:
classExView
. d:\inetpub\wwwroot\webmddb\
.This sample assumes that the class.webmddb
data file is stored in d:\inetpub\wwwroot\webmddb\
. To accommodate Java programming conventions, double backslashes are used in the directory path.
<jsp:useBean id="classExView" class="com.sas.servlet.tbeans.webmddbview.WebMDDBView" scope="session"> <jsp:setProperty name="classExView" property="fileName" value="d:\\inetpub\\wwwroot\\WEBMDDB\\class.webmddb" /> <jsp:setProperty name="classExView" property="styleClass" value="wTable" /> </jsp:useBean> <html> <head> <LINK REL=STYLESHEET HREF="sasComponents.css" TYPE="text/css"> </head> <body> <H5>EXAMPLE</H5> <BR><BR> <% classExView.processCommand(request); classExView.write(out); %> <BR><BR><BR> </body> </html>
Also, add any other HTML content that you want to appear in the report.
Note: Refer to your application server software documentation for information about how to deploy JSPs for testing and for production.
Give the same name to the three files that are used to create the WEBMDDB report. The three files are:
*.sas
) program that creates the WEBMDDB data file.*.webmddb
) data file. You define a fileref for the WEBMDDB data file using the FILENAME statement, then you specify the fileref with the OUT= option on the PROC WEBMDDB statement. *.jsp
) file that includes the code that interprets the WEBMDDB data file. You name the JSP file with the JSP= option on the PROC WEBMDDB statement, and then you paste in the appropriate code (see Deploying the WEBMDDB Data File).For example, if you name your SAS program foo.sas
, then name your WEBMDDB file foo.webmddb
, and name your JSP file foo.jsp
. Within the JSP file, change all session object references to fooExView
.
The appearance of the WEBMDDB report is controlled by a cascading style sheet (CSS). To change the default style settings, you edit the CSS (using a text editor, for example). The CSS includes the following style classes:
The WEBMDDB procedure is not supported by SAS Institute Technical Support.
Note that the toString() method on this class calls the write
method, which may have undesirable side effects. See BaseTransformation.toString() for more information. Debuggers often use toString() to show the value of a variable, and this may cause unexpected behavior while debugging
Field Summary | |
---|---|
static int |
COLLAPSE_COMMAND
Returned by process command method when a collapse command is being processed |
static int |
EXPAND_COMMAND
Returned by process command method when a expand command is being processed |
static int |
NULL_COMMAND
Returned by process command method when a no command information could be processed. |
static java.lang.String |
RB_KEY
|
static int |
SHOW_DETAIL_DATA_COMMAND
Returned by process command method when a show detail command is being processed |
Constructor Summary | |
---|---|
WebMDDBView()
Default Constructor |
|
WebMDDBView(java.lang.String name)
Constructor |
Method Summary | |
---|---|
java.lang.String |
getFileName()
Returns the name of the text file to read. |
int |
processCommand(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Processes the parameters found on the request object. |
int |
processCommand(javax.servlet.jsp.PageContext pageContext)
Processes the parameters found on the request object. |
void |
setFileName(java.lang.String fname)
Sets the name of the text file to be read |
void |
setFileName(java.lang.String fname,
javax.servlet.jsp.PageContext pc)
Sets the name of the text file to be read. |
void |
setFileName(java.lang.String fname,
javax.servlet.ServletContext sc)
Sets the name of the text file to be read. |
void |
write(java.io.PrintWriter out)
Writes the content to the PrintWriter object. |
Field Detail |
---|
public static final int NULL_COMMAND
public static final int EXPAND_COMMAND
public static final int COLLAPSE_COMMAND
public static final int SHOW_DETAIL_DATA_COMMAND
public static final java.lang.String RB_KEY
Constructor Detail |
---|
public WebMDDBView()
public WebMDDBView(java.lang.String name)
name
- the name of the object.Method Detail |
---|
public void write(java.io.PrintWriter out) throws java.io.IOException
write
in interface TransformationInterface
write
in interface com.sas.util.WriteToPrintWriterInterface
write
in class BaseTransformation
out
- java.io.PrintWriter object
java.io.IOException
- Thrown if some type of I/O error occurspublic java.lang.String getFileName()
public void setFileName(java.lang.String fname) throws java.io.IOException
fname
- name of the text file.
java.io.IOException
public void setFileName(java.lang.String fname, javax.servlet.jsp.PageContext pc) throws java.io.IOException
fname
- virtual path for the filepc
- PageContext object
java.io.IOException
public void setFileName(java.lang.String fname, javax.servlet.ServletContext sc) throws java.io.IOException
fname
- virtual path for the filepc
- PageContext object
java.io.IOException
public int processCommand(javax.servlet.jsp.PageContext pageContext) throws java.io.IOException
pageContext
- javax.servlet.jsp.PageContext object
java.io.IOException
public int processCommand(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws java.io.IOException
req
- HttpServletRequest objectresp
- HttpServletRepsonse object
java.io.IOException
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |