SAS 9.1 Output Delivery System Users Guide

PROC TEMPLATE ;

DEFINE TAGSET tagset- path </ STORE= libref . template-store >;

DEFINE TAGSET Statement

Creates a tagset definition

Requirement: An END statement must be the last statement in the definition.

Featured in: All examples found in the 'Examples: Creating and Modifying Markup Languages Using the TEMPLATE Procedure' on page 588 section.

DEFINE TAGSET tagset-path </ STORE= libref . template-store < (READ WRITE

statements and attributes

Table 11.1: DEFINE TAGSET Statements

Task

Statement

Define what is written to the output file.

DEFINE EVENT

Provide information about the tagset definition.

NOTES

End a tagset definition, or end the editing of a tagset definition.

END

Required Arguments

tagset-path

Options

STORE= libref . template-store

access-options

Tagset Attributes

Table 11.2: Tagset Attributes

Task

Attribute

Valid destinations

Specify the text to use as a copyright.

COPYRIGHT=

HTML, MARKUP

Specify the name of the event to use by default.

DEFAULT_EVENT=

HTML, MARKUP

Specify whether or not the tagset supports embedded stylesheets.

EMBEDDED_STYLESHEET

HTML, MARKUP

Set a numeric value to use as the indention depth.

INDENT=

MARKUP

Specify a string which will be printed to the SAS log when the tagset is used.

LOG_NOTE

HTML, MARKUP

Specify special characters and their translations.

MAP=

HTML, MARKUP

Specify strings to substitute for special characters.

MAPSUB=

HTML, MARKUP

Define a nonbreaking space for the markup output.

OUTPUT_TYPE=

HTML, MARKUP

Sets a category for the output.

NOBREAKSPACE=

HTML, MARKUP

Specify the tagset definition from whichthecurrentdefinitioninherits.

PARENT=

HTML, MARKUP

Specify the text to use as a registered trademark.

REGISTERED_TM=

HTML, MARKUP

Define a string to use for line breaks in the markup output.

SPLIT=

HTML, MARKUP

Specify whether or not the tagset allows procedures to place columns one ontopofanother, orsidebyside.

STACKED_COLUMNS

HTML, MARKUP

Specify the text to use as a trademark.

TRADEMARK=

HTML, MARKUP

COPYRIGHT= '( text )'

DEFAULT_EVENT= ' event-name '

EMBEDDED_STYLESHEET= YES ON NO OFF

INDENT= n

LOG_NOTE= ' string '

MAP= ' characters '

MAPSUB= ' strings '

NOBREAKSPACE= ' string '

OUTPUT_TYPE= CSV HTML LATEX WML XML

PARENT= tagset-path

REGISTERED_TM= '( text )'

SPLIT= ' string '

STACKED_COLUMNS= YES ON NO OFF

TRADEMARK= '( text )'

DEFINE EVENT Statement

Defines what is written to the output file

Interaction: Event statement conditions can be added to any DEFINE EVENT statement. For more information about event statement conditions, see 'Event Statement Conditions' on page 571

Featured in: Example 6 on page 603 and Example 7 on page 605

Table 11.3: DEFINE EVENT Statements

Task

Statement

Set one or more event attributes.

event-attributes

Disable the specified event.

BLOCK

Prevent an event from executing.

BREAK

Close the current stream to which all PUT statement variables are directed

CLOSE

Delete the specified stream.

DELSTREAM

Write buffered output to the current output file or stream.

FLUSH

Indent output one more indentation level.

NDENT

Open or create the specified stream.

OPEN

Write text or variable data to an output file.

PUT

Add a new line to the end of the output.

PUTL

Writes the text, or the value of the event variable to the log.

PUTLOG

Place quotes around the value in a variable.

PUTQ

Write the contents of the streamto the current output file.

PUTSTREAM

Writes the name or value of an event, dynamic, memory, or stream variable to an output file.

PUTVARS

Specify a user-defined event variable and its value.

SET

Execute another event.

TRIGGER

Delete user-defined variables.

UNSET

Enable a disabled event.

UNBLOCK

Indent output one less indentation level.

XDENT

End the definition.

END

DEFINE Event Statement

Defines what is written to the output file

DEFINE EVENT event-name ;

Required Arguments

event-name

Event Attributes

Table 11.4: Event Attributes

Task

Attribute

Valid destinations

Redirect event output to any of the known types ofoutputthatare open.

FILE=

HTML, MARKUP

Enable the event to use any style element that has been defined.

PURE_STYLE=

MARKUP

Specify a style element.

STYLE=

HTML, MARKUP

FILE= BODY CODE CONTENTS FRAME PAGES STYLESHEET

PURE_STYLE= YES NO

STYLE= style-element ;

BLOCK Statement

Disables the specified event

Tip: To enable the blocked event, use the UNBLOCK statement.

Tip: You can block the same event multiple times, but in order to enable the event, you must use the same number of UNBLOCK statements.

BLOCK event-name </ event-statement-conditions >;

Required Arguments

event-name

Options

event-statement-conditions

BREAK Statement

Stops an event from executing

Tip: The BREAK statement is most useful when combined with event conditions.

BREAK </ event-statement-conditions >;

Options

event-statement-conditions

CLOSE Statement

Closes the current stream and directs all future output to the output file

CLOSE </ event-statement-conditions >;

Options

event-statement-conditions

DELSTREAM Statement

Deletes the specified stream

DELSTREAM stream-name </ event-statement-conditions >;

Required Arguments

stream-name

Options

event-statement-conditions

FLUSH Statement

Writes any buffered output to the current output file or stream

FLUSH </ event-statement-conditions >;

Options

event-statement-conditions

NDENT Statement

Indents output one more indention level than the number of spaces specified by the INDENT= statement

Interaction: The start position of the indention level is set by the INDENT= attribute.

Featured in: Example 3 on page 597 and Example 5 on page 601

NDENT </ event-statement-conditions >;

Options

event-statement-conditions

OPEN Statement

Opens the specified stream or creates one if the specified stream does not exist

Interaction: If another stream is open, then it will be closed when you specify a new stream to be opened.

Interaction: All text or variable data specified in the PUT statements that occur after the OPEN statement, will append to the stream instead of the output file.

OPEN stream-name </ event-statement-conditions >;

Required Arguments

stream-name

Options

event-statement-conditions

PUT Statement

Writes the text, or the value of an event variable to an output file

Requirement: You must enclose the text string in quotation marks.

Featured in: Example 1 on page 588, Example 3 on page 597, Example 4 on page 599, Example 5 on page 601, and Example 6 on page 603

PUT ' text ' VALUE < / event-statement-conditions >;

Required Argument

text

specifies a text string that provides information about your output.

Interaction: The PUT statement pairs strings with variables. If a string is followed by a variable, they become a pair. If the variable has a value, then the pair becomes output. If the variable does not have a value, then neither will be output.

Requirement: The text must be enclosed in quotation marks.

VALUE

specifies the value of the event variable.

Interaction: The PUT statement pairs strings with variables. If a string is followed by a variable, they become a pair. If the variable has a value, then the pair becomes output. If the variable does not have a value, then neither will be output.

See: For a list of event variables, see 'List of Event Variables' on page 572

Options

event-statement-conditions

PUTL Statement

Adds a new line to the end of the output

Alias: CR, NL, or LF

Tip: Use the PUTL statement when your event output is large.

PUTL </ event-statement-conditions >;

Options

event-statement-conditions

PUTLOG Statement

Writes the text, or the value of the event variable to the log

Requirement: You must enclose the text string in quotation marks.

PUTLOG ' text '</ event-statement-conditions >;

Required Argument

text

Options

event-statement-conditions

PUTQ Statement

Places quotes around the value in an event variable or a style variable

Featured in: Example 7 on page 605

PUTQ ' text ' event-variable </ event-statement-conditions >;

Required Argument

text

event-variable

Options

event-statement-conditions

PUTSTREAM Statement

Writes the contents of the stream to the current output file

PUTSTREAM stream-name </ event-statement-conditions >;

Required Arguments

stream-name

Options

event-statement-conditions

PUTVARS Statement

Writes the name or value of an event, dynamic, memory, or stream variable to an output file

Interaction: The PUTVARS statement loops through all the variables in the variable group. Each iteration populates special variables which can be used in the format.

PUTVARS variable-group </ event-statement-conditions >;

Required Argument

variable-group

Options

event-statement-conditions

SET Statement

Specifies a user-defined variable and its value

Requirement: The user-defined variable must be preceded by a '$' character.

Tip: User-defined variables are case insensitive.

SET $ user-defined-event-variable user-defined-value </ event-statement-conditions >;

Required Arguments

user-defined-event-variable

user-defined-value

Options

event-statement-conditions

TRIGGER Statement

Executes another event

Tip: The TRIGGER statement explicitly requests a specific action of an event.

Featured in: Example 3 on page 597, Example 4 on page 599, Example 5 on page 601, and Example 6 on page 603

TRIGGER event-name < START FINISH ></ event-statement-conditions >;

Required Arguments

event-name

Without Options

If a triggered event does not have start or finish sections, then it will run the statements it does have.

Options

START

FINISH

event-statement-conditions

UNBLOCK Statement

Enables a disabled event

Interaction: To disable an event, use the BLOCK statement.

Requirement: Because you can block the same event multiple times, in order to enable the event, you must use the same number of UNBLOCK statements as BLOCK statements.

UNBLOCK event-name </ event-statement-conditions >;

Required Arguments

event-name

Options

event-statement-conditions

UNSET Statement

Deletes the user-defined-variables and their values

Requirement: To specify the user-defined-variable , you must precede the name with a '$' character.

UNSET $ user-defined-event-variable ALL </ event-statement-conditions >;

Required Arguments

$user-defined-event-variable

ALL

Options

event-statement-conditions

XDENT Statement

Indents output one less indention level, using the number of spaces specified by the INDENT= attribute

Interaction: The starting level of indention is set by the INDENT= statement.

Featured in: Example 3 on page 597 and Example 5 on page 601

XDENT </ event-statement-conditions >;

Options

event-statement-conditions

END Statement

Ends the event definition

END ;

Event Statement Conditions

Conditions can be added to any DEFINE EVENT statement. A condition must be preceded with a slash (/).

event-statement </ event-statement-condition >;

Event Statement Conditions

event-statement

event-statement-condition

Event Variables

List of Event Variables

Event variables include text, formatting, and data values. These variables originate from many places, such as the table definition, the procedure, title, byline processing, and more. Event variables also include any style attributes that you are using in your program. The following table lists the event variables that are used in the DEFINE EVENT statement of PROC TEMPLATE.

Table 11.5: Event Variables

Event variable

Description

ABBR

specifies an abbreviation for the event variable. [*]

ACRONYM

specifies an acronym for the event variable. [*]

ALT

specifies an alternate description of the event variable. [*]

AFTER

specifies that the current note is an after note.

ANCHOR

specifies the current anchor, which is the last value of the anchor tag (for example, IDX).

ARCHIVE

used by the SAS/GRAPH to specify the Java archive (.jar) file to be used. CODEBASE must be used to specify the directory containing the .jar file.

ASIS

specifies how to handle leading spaces and line breaks.

ATTR_NAME

used by the DATA step interface.

ATTR_VALUE

used by the DATA step interface.

AUTHOR

specifies the author of the output. Set from the ODS statement, or, by default, is the user that is running SAS.

BACKGROUND

specifies the color of the background.

BACKGROUNDIMAGE

specifies the background image. This image will be stretched .

BEFORE

specifies that the current note is a before note.

BASENAME

specifies the name of the BASE= option as set in the ODS statement.

BODY_NAME

specifies the name of the body file.

BODYSCROLLBAR

specifies whether to put a scroll bar in the frame that references the body file.

BODYSIZE

specifies the width of the frame in the HTML frame file that displays the body file.

BODY_TITLE

specifies the title of the body file.

BODY_URL

specifies the URL of the body file.

BORDERCOLOR

specifies the color of the border if the border is only one color.

BORDERCOLORDARK

specifiesthe darker color in theborder that uses two colors to create a three-dimensional effect.

BORDERCOLORLIGHT

specifies the lightercolor in the borderthat uses two colors to create a three-dimensional effect.

BORDERWIDTH

specifies the width of the border of the table.

BOTTOMMARGIN

specifies the bottom margin for the document.

BULLET

specifies the string to use for bullets in the contents file.

CAPTION

[*] specifies the caption for the table.

CELLHEIGHT

specifies the height of the cell .

CELLPADDING

specifies the amount of white space on each of the four sides of the text in a cell.

CELLSPACING

specifies the width of the spacing between cells .

CELLWIDTH

specifies the width of the cell.

CLABEL

specifies the label for the output object in the contents file, the Results window, and the trace record. Set with the CONTENTS_LABEL= attribute in the table definition.

CLASSID

used by SAS/GRAPH to specify where to place the ActiveX files in the Windows registry.

CODE

used by SAS/GRAPH to specify which Java class to activate when the applet opens.

CODEBASE

used by SAS/GRAPH to specify the directory where the Java archive (.JAR) files are located. ARCHIVE must also be used to specify the .JAR file. For ActiveX, the location of the ActiveX set-up file is specified.

CODE_NAME

specifies the name of the code file.

CODE_TITLE

specifies the title of the code file.

CODE_URL

specifies the URL of the code file.

COLCOUNT

specifies the number of columns in the current table.

COLEND_EA

specifies the ending column number.

COL_ID

specifies the column ID to identify columns. Used for the OIMDBM format type by the XML LIBNAME engine.

COLSPAN

specifies the number of columns that the cell spans .

COLSTART

specifies the column number where the cell starts.

CONTENTS_NAME

specifies the name of the contents file.

CONTENTPOSITION

specifies the position, within the frame file, of the frames that display the contents and the page files.

CONTENTSCROLLBAR

specifies whether to put a scroll bar in the frames that display the contents and the page files.

CONTENTSIZE

specifies the width of the frames that display the contents and the page files.

CONTENTS_TITLE

specifies the title of the contents file.

CONTENTS_URL

specifies the URL of the contents file.

CONTRASTCOLOR

specifies alternate colors for maps. The alternate colors are applied to the blocks on region areas in block maps.

COORDINATE

used by SAS/GRAPH to specify the coordinates for a specified shape.

DATA_NAME

specifies the name of the data file.

DATA_TITLE

specifies the title of the data file.

DATA_URL

specifies the URL of the data file.

DATA_ROW

specifiesthat the currentrowis adata row.

DATE

specifies the date.

DEFAULT_JUST

specifies the default horizontal justification. Internal use only.

DEFAULT_VJUST

specifies the default vertical justification. Internal use only.

DEST_FILE

specifies the current destination file: body, contents, pages, frame, code, or stylesheet.

DNAME

specifies the name of the column in the data component to associate with the current column. DNAME is set with the DATANAME= attribute in the column definition.

DROPSHADOW

specifies a drop shadow effect for text in a graph.

EMPTY

sets a flag to determine whether an event is called as an empty tag.

ENCODING

specifies the encoding of the output for converting text data into a numbering system that computers recognize.

ENDCOLOR

specifies the end color for a gradient effect in a graph.

EVENT_NAME

specifies the requested event name.

FILLRULEWIDTH

specifies the width of the fill rule.

FIRSTPAGE

specifies the first page of the output file.

FLYOVER

specifies the text to show in a tool tip for the cell.

FONT

specifies the font definition.

FONT_FACE

specifies the name of the font face.

FONT_SIZE

specifies the size of the font.

FONT_STYLE

specifies the style of the font.

FONT_UNDERLINE

specifies the underline character.

FONT_UNDERLINE is only used by the ODS MARKUP statement.

FONT_WEIGHT

specifies the weight of the font.

FONT_WIDTH

specifies the width of the font.

FOREGROUND

specifies the color of the foreground.

FRAME

specifies the type of frame to use on a table.

FRAMEBORDER

specifies whether to put a border around the frame for an HTML file that uses frames.

FRAMEBORDERWIDTH

specifies the width of the border around the frames for an HTML file that uses frames.

FRAME_NAME

specifies the name of the frame file.

FRAMESPACING

specifies the width of the space between frames for an HTML file that uses frames.

FRAME_TITLE

specifies the title of the frame file.

FRAME_URL

specifies the URL of the frame file.

GRAPH_PATH_NAME

specifies the path of the graph as given in the ODS PATH statement.

GRAPH_PATH_URL

specifies the URL of the graph.

GRADIENT_DIRECTION

specifies the direction of the gradient effect in either the X or Y axis direction to influence the graph background, legend background, charts , walls, floors, etc.

HIDDEN

specifies that the current object is hidden.

HREFTARGET

specifies the window or frame in which to open the target of the link.

HTMLCLASS

specifies the name ofthe stylesheet class to use for the table or cell.

HTMLCONTENTTTYPE

specifies the value of the content type for pages that you send directly to a web server rather than to a file.

HTMLDOCTYPE

specifies the entire doctype declaration for the HTML document.

HTMLID

specifies the ID for the table or cell.

HTMLSTYLE

specifies individual attributes and values for the table or cell.

IMAGE

specifies the image to appear in the background. This image can be positioned or tiled.

IN_ASSOCIATION

specifies the combination of a caption and a table. Associations are used in PROC REPORT, PROC TABULATE, and PROC FREQ cross-tabulations.

IN_CAPTION

specifies a caption.

IS_NOTE

specifies a note.

IS_STACKED

specifies that the columns are stacked.

IS_TITLE

specifies that the current procedure title remains a title.

JUST

specifies the horizontal justification.

LABEL

specifies the label for the variable. Set with the LABEL= attribute in the column definition.

LANGUAGE

specifies the language of the current output. LANGUAGE is set when it is only an Asian language.

LEFTMARGIN

specifies the left margin for the document.

LINESTYLE

specifies the line type to use in a graph. You can use SAS/GRAPH line types 1-46.

LINKCOLOR

specifies the color for links that have not yet been visited.

LISTENTRYANCHOR

specifies whether to make the entry in the table of contents a link to the body file.

LONGDESC

specifies the long description of an event variable. [*]

MISSING

specifies the value that indicates that no data value is stored. By default, SAS uses a single period (.) for a missing numeric value and a blank space for a missing character value. In addition, for a numeric missing value, a special missing value can be used to represent different categories of missing data by assigning the letters A - Z or an underscore .

NAME

specifies the name of the variable. NAME is set with the VARNAME= attribute in the column definition.

_NAME_

contains the name of the current variable.

NOBASE

sets a flag to determine whether to use the value for BASE= option as part of the URL. 0 uses the BASE= option and 1 does not use BASE= option.

NOBREAKSPACE

specifies how to handle spaces at line breaks.

NO_WRAP

specifies that the current cell should not wrap text or insert hyphens.

OPERATOR

specifies the operator. OPERATOR is set from the ODS statement, or, by default, it is the user that is running SAS.

OUTPUTHEIGHT

specifies the height for a graph or the graphics in the output.

OUTPUT_LABEL

specifies the label of the current output object.

OUTPUT_NAME

specifies the name of the current output object.

OUTPUTWIDTH

specifies the width of a table, graph, orline thickness .

OVERHANGFACTOR

specifies the upper limit for extending the width of the column.

PAGEBREAKHTML

specifies the HTML to place at page breaks.

PAGE_COUNT

specifies the page count sincethe fileswere opened.

PAGES_NAME

specifies the name of the pages file.

PAGES_TITLE

specifies the title of the pages file.

PAGES_URL

specifies the URL of the pages file.

PATH

specifies the path as set by the ODS statement.

PATH_NAME

specifies the path name.

PATH_URL

specifies the path location.

POSTHTML

specifies the HTML code to place after the table or cell.

POSTIMAGE

specifies the image to place after the table or cell.

POSTTEXT

specifies the text to place after the table or cell.

PRECISION

specifies the number of places to the right of the decimal. PRECISION is used by the XML LIBNAME engine.

PREHTML

specifies the HTML code to place before the table or cell.

PREIMAGE

specifies the image to place before the table or cell.

PRETEXT

specifies the text to place before the table or cell.

PROC_COUNT

specifies how many procedures have run since the files were opened.

PROC_NAME

specifies the name of the current procedure.

PROTECTSPECIALCHARACTERS

specifies how the less-than (<) and greater-than (>) signs and the ampersand (&) are interpreted.

RAWVALUE

specifies the base64 encoding of the stored machine representation of the original value.

REF_ID

specifies the reference ID for references to columns. Used by the XML LIBNAME engine for the OIMDBM format type.

RIGHTMARGIN

specifies the right margin for the document.

ROW

specifies the current table row, which includes headers.

ROWSPAN

specifies the number of rows that the current cell spans.

RULES

specifies the type of line that is used between table cells.

SASLONGVERSION

specifies the long format of the SAS version.

SASVERSION

specifies the short format of the SAS version.

SCALE

specifies the total number of places in the floating point number. SCALE is used by the XML LIBNAME engine.

SECTION

specifiesthe head, body, orfootofthe table.

SHAPE

is used with SAS/GRAPH to specify the type of shape to draw.

SPACE

specifies the string that the tagset uses for a nonbreaking space.

SPLIT

specifies the string that the tagset uses for line breaks.

STARTCOLOR

specifiesthe start color for a gradienteffect in a graph.

STATE

specifies the current state of the event, which is either START or FINISH.

STYLE

specifies the current style that is being used.

STYLESHEET_NAME

specifies the name of the stylesheet file.

STYLESHEET_TITLE

specifies the title of the stylesheet file.

STYLESHEET_URL

specifies the URL of the stylesheet file.

SUMMARY

[*] specifies a summary of the table.

TAGATTR

specifies the text to insert in the HTML.

TAG_NAME

specifies the tag name.

TAGSET

specifies the name of the current tagset.

TAGSET_ALIAS

specifies the alias of the current tagset as given in the ODS MARKUP statement.

TARGET

specifies the target that is associated with the URL.

TEXT

specifies the tag names. TEXT is used by the XML LIBNAME engine.

TIME

specifies the time.

TITLE

specifies the title from the ODS statement.

TOCLEVEL

specifies the table of contents level.

TOPMARGIN

specifies the top margin for the document.

TOTAL_PAGE_COUNT

specifies the total page count since ODS was opened.

TOTAL_PROC_COUNT

specifies how many procedures that have run since the ODS was opened.

TRANSPARENCY

specifies the level of transparency for a graph.

TRANTAB

specifies the translation table name for character conversions.

TRIGGER_NAME

specifies the name of the event that is triggered.

TYPE

specifies the STRING, DOUBLE, CHAR, BOOL, or INT data type.

URL

specifies the URL to link to when the item is clicked.

VALUE

specifies the current value.

_VALUE_

contains the value of the current variable.

VALUECOUNT

specifies the count of the variable.

VISITEDLINKCOLOR

specifies the color for links that have been visited.

VJUST

specifies the vertical justification.

WATERMARK

specifies whether to make the image that is specified by BACKGROUNDIMAGE into a watermark.

WIDTH

specifies the width. Most commonly used for COLSPECS.

XMLDATAFORM

specifies whether the tag for an element to contain SAS variable information (name and data) is to appear in an open element or an enclosed attribute format.

XMLDATAFORM is used by the XML LIBNAME engine.

XMLMETADATA

specifies the metadata for the XML tagset.

XMLSCHEMA

specifies whether or not to generate schema- related information.

XMLSCHEMA is used by the XML LIBNAME engine.

[*] SAS includes these accessibility and compatibility features to improve the usability of SAS for users with disabilities . These features are related to accessibility standards for electronic information technology that are adopted by the U.S. Government under Section 508 of the U.S. Rehabilitation Act of 1973, as amended.

NOTES Statement

Provides information about the tagset definition

Tip: The NOTES statement becomes part of the compiled tagset definition, which you can view with the SOURCE statement.

Featured in: Example 3 on page 597 and Example 9 on page 610

NOTES ' text ';

Required Arguments

text

END Statement

Ends the tagset definition

END ;

Категории