SAS 9.1.3 Integration Technologies » Developer's Guide


Viewer Processing
Usage
When to Use a Viewer
How to Create a Viewer
How to Apply a Viewer
Reference
SASINSERT Tag
Substitution Syntax
SASTABLE Tag
SASREPEAT Tag
SASECHO Tag
Examples
Using the SASINSERT and SASTABLE Tags
Sample HTML Viewer
SAS Program with an HTML Viewer
Sample Viewer Template
Publishing Framework

<SASTABLE> Tag

Populates HTML or text tables and lists.

Syntax

   <SASTABLE  nested=z entry=x 
      attribute=value>
      /* insert HTML tags or static text as needed here */
   $(variable=variableName)
      /* insert HTML tags or static text as needed here */
   </SASTABLE>

The attributes of the <SASTABLE> tag are defined as follows:

nested=z
identifies an optional nested package within the main package that is to be used to build the table or list. If the NESTED attribute is not specified, only the main package is used to build the table or list. The numerical and name/value syntax options available for the z value are defined in Specifying Values for the NESTED and ENTRY Attributes.

entry=x
identifies the entry within the specified package that is to be used to build the table or list. The numerical and name/value syntax options available for the x value are defined in Specifying Values for the NESTED and ENTRY Attributes.

first=a
specifies an optional numeric that designates the first row that is to be inserted into the table or list. The default value is 1.

last=b
specifies the last row of optional numeric data that is to be inserted into the table or list. The default is the last row in the specified entry.

Note: The LAST attribute and the N attribute are mutually exclusive. If both are specified, the last one is used.

n=c
specifies the total number of optional rows that are to be inserted into the table or list, beginning with the first row in the entry. The default is all rows in the entry.

Note: The N attribute and the LAST attribute are mutually exclusive. If both are specified, the last one is used.

Details

Within the <SASINSERT> tags, the <SASTABLE> tag supports the development of HTML lists and tables. The <SASTABLE> tag populates tables and lists by repetitively inserting HTML tags or static text and specified data into HTML or text output. The insertion repeats for each row of data that has been specified for insertion. The location of the data and the rows of data to be inserted are determined by the attributes of the <SASTABLE> tag.

Variable Substitution

Variable substitution is valid within the <SASTABLE> open tag and the </SASTABLE> closing tag. The variable substitution syntax is

   $(VARIABLE=variableName)

The variable substitution syntax specifies that the value of the VARIABLE attribute in the data set is to be substituted into the tables and lists in either HTML or plain text format. This attribute is valid only within the <SASTABLE> tag. The entry that is named in the <SASTABLE> tag must be a valid SAS data set. Any number of variable substitutions can be specified within the <SASTABLE> tag as long as each one references a valid variable in the SAS data set.

Examples

The following example uses the <SASINSERT> and <SASTABLE> tags to build a list. The SAS data set that is used is the second entry that is added to the main package. The value of the fileName variable is substituted on each repetition.

   <p>
   <SASINSERT>
   <ul>
   <SASTABLE ENTRY=2>
   <li>$(VARIABLE=fileName)</li>
   </SASTABLE>
   </ul>
   </SASINSERT>

The following example uses the <SASINSERT> and <SASTABLE> tags to build a table. The SAS data set entry is the first entry in the main package. The value of the variables fname, lname, state, and homepage are used to create the table. The newly created table will contain one row for each row in the main package.

   <SASINSERT>
   <h1>Table Example using SASTABLE</h1>
   <table border cellspacing=0 cellpadding=5 
      rules=groups>
   <thead>
   <tr><th>First Name</th>
   <th>Last Name</th>
   <th>State </th>
   <th>HomePage</th></tr>
   <tbody>
   <SASTABLE ENTRY=1>
   <tr> <td> $(VARIABLE=fname)</td>
   <td> $(VARIABLE=lname)</td>
   <td> $(VARIABLE=state)</td>
   <td> <a href=$(VARIABLE=homepage)> 
      $(VARIABLE=homepage)</a></td></tr>
   </SASTABLE>
   </table>
   </SASINSERT>