INSERT_HTML

Inserts HTML files into a package

Syntax

CALL INSERT_HTML(packageId, body, bodyUrl, frame, frameUrl, contents, contentsUrl,
page, pageUrl, desc, nameValue, rc<, properties, propValue1, ...propValueN> );

Required Arguments

packageId
identifies the package.
Type:Numeric, Input
body
names the HTML body file, using the following syntax:
  • FILEREF: SAS_fileref
  • FILENAME: external_filename
For information about inserting multiple body files, see the Details section.
Type:Character, Input
bodyURL
specifies the URL to be used for the body file.
Type:Character, Input
frame
names the HTML frame file, using the following syntax:
  • FILEREF: SAS_fileref
  • FILENAME: external_filename
Type:Character, Input
frameURL
specifies the URL to be used for the frame file.
Type:Character, Input
contents
names the HTML contents file, using the following syntax:
  • FILEREF: SAS_fileref
  • FILENAME: external_filename
Type:Character, Input
contentsURL
specifies the URL to be used for the contents file.
Type:Character, Input
page
names the HTML page file, using the following syntax:
  • FILEREF: SAS_fileref
  • FILENAME: external_filename
Type:Character, Input
pageURL
specifies the URL to be used for the page file.
Type:Character, Input
desc
describes the inserted HTML package entry.
Type:Character, Input
nameValue
identifies a list of one or more space-separated name/value pairs, each in the form of name=value. Name/value pairs are site-specific; they are used for the purpose of filtering.
Type:Character, Input
rc
receives a return code.
Type:Numeric, Output

Optional Arguments

properties
identifies a comma-separated list of optional property names. Valid property names are as follows:
  • ENCODING
  • COMPANION_FILE
  • COMPANION_MIMETYPE
  • COMPANION_URL
  • GPATH
  • GPATH_URL
  • NESTED_NAME
Type:Character, Input
propValue1, …propValueN
specifies one value for each specified property name. The order of the property values must match the order of the property names in the properties parameter. Valid property values are defined as follows:
ENCODING indicates the character set of the HTML files, such as ISO-8859-1. The default encoding is assumed from the native session.
COMPANION_FILE indicates the name of an additional HTML file that is to be added to this set of HTML files. Multiple COMPANION_FILE properties and values can be specified. Name the companion files, using either FILEREF:SAS_fileref or FILENAME:external_filename.
COMPANION_MIMETYPE indicates the MIME type of the companion file that is to be added to the inserted HTML entry. If specified, then this property must be preceded by the COMPANION_FILE property.
COMPANION_URL indicates the URL of an HTML file that is to be added to the inserted HTML entry. If specified, then this property must be preceded by the COMPANION_FILE property.
GPATH indicates the name of a single directory that contains the ODS-generated graphical files for inclusion as companion files to the HTML file set. Note that all files in the specified directory are included as companion files.
GPATH_URL indicates the URL of the directory that contains the ODS-generated graphical files. An example of a URL might be ~ods-output/images. Alternatively, you can specify "NONE" as the GPATH_URL property value. If the value of "NONE" is specified, then only the filename is used as the URL. Note that if GPATH_URL is specified, then you must also specify the GPATH property.
NESTED_NAME indicates the name of the nested directory to create for the storage of the set of HTML files. If you do not specify a value for this property, then a name is generated automatically. Note that the NESTED_NAME property is valid only when publishing to the WebDAV-compliant server transport.
Type:Character, Input

Details

The files that can be inserted include the body, frame, contents, and page files.
When the NEWFILE= option is specified in the ODS HTML statement, ODS might generate multiple body files. When ODS generates multiple body files, it uses a numeric file naming sequence of the general form: bodyfilenameNumber, as in body1.html, body2.html, body3.html. To insert an entire sequence of body files, use the following syntax:
FILENAME: bodyFilename*.extension
When an asterisk is specified in the body parameter, an asterisk should also be specified in the bodyUrl parameter. For further information about ODS, see SAS Output Delivery System: User's Guide.
Note: As a best practice, it is suggested that a MIME type be provided for any companion files inserted into the HTML entry. The MIME type is useful for applications that will later consume or display the published package.

Examples

Example 1: Using INSERT_HTML

The following example generates ODS files and inserts those files into a package.
Desc='HTML output for payroll processing';
nameValue = '';
filename f '/users/f.html';
filename c '/users/c.html';
filename b '/users/b.html';
filename p '/users/p.html';
ods html frame=f contents=c(url='c.html')
   body=b(url='b.html') page=p(url='p.html');

/* insert SAS statements here to generate ODS output */

ods html close;

CALL INSERT_HTML(packageId, 'fileref:b', "b.html",
   'fileref:f', "f.html", 'fileref:c', "c.html",
      'fileref:p', "p.html", desc, nameValue, rc);

Example 2: Using INSERT_HTML with the ENCODING Property

The following example replaces the INSERT_HTML CALL routine in the example above with another version of the CALL routine that inserts ODS files by using the ENCODING property. In this case, the ENCODING property specifies the ISO-Latin-1 character set.
Desc='HTML output for payroll processing';
nameValue = '';
CALL INSERT_HTML(packageId, 'fileref:b', "b.html",
   'fileref:f', "f.html", 'fileref:c', "c.html",
      'fileref:p', "p.html", desc, nameValue, rc,
      "encoding", "ISO-8859-1");

Example 3: Using INSERT_HTML with a Specified Character Set Encoding

The following example specifies a character set encoding and adds two HTML files to the original set of inserted files.
Desc='HTML output for payroll processing';
nameValue = '';
properties='encoding, companion_file, companion_file';
encodingV = "ISO-88591-1";
file1 = "filename: report.html";
file2 = "filename: dept.html";
CALL INSERT_HTML(packageId, 'fileref:b', "b.html",
   'fileref:f', "f.html", 'fileref:c', "c.html",
   'fileref:p', "p.html", desc, nameValue, rc,
   properties, encodingV, file1, file2);

Example 4: Using an Asterisk (*) to Specify a Set of Files

The following example uses an asterisk (*) to specify that all body files are to be included in the set of inserted HTML files. The naming sequence used is the same as the naming sequence used in ODS. So the files body.html, body1.html, body2.html, and so on (for all files found in this sequence), will be published. For further information about the ODS naming sequence used in conjunction with the NEWLINE= option, see the SAS Language Reference: Concepts.
Desc='HTML output for payroll processing';
nameValue = '';
CALL INSERT_HTML(packageId,
   'filename:/users/jsmith/body*.html', "body*.html",
   'fileref:f', "f.html", 'fileref:c', "c.html",
   'fileref:p', "p.html", desc, nameValue, rc);