PROC TEMPLATE ;
DELETE definition- path < / STORE= libref . template-store >;
LINK definition-path-1 TO definition-path-2 </ option(s) >;
LIST < starting-path ></ option(s) >;
PATH location(s) ;
SOURCE definition-path </ option(s) ><STORE= libref . template-store >;
TEST DATA= SAS-data-set < / STORE= libref . template-store >;
Task | Statement |
---|---|
Delete the specified definition | 'DELETE Statement' on page 273 |
Create a link to an existing definition | 'LINK Statement' on page 273 |
List items in one or more template stores | 'LIST Statement' on page 274 |
Specify which locations to write to or read from when you create or use PROC TEMPLATE definitions, and specify the order in which to search for them | 'PATH Statement' on page 276 |
Write the source code for the specified definition to the SAS log | 'SOURCE Statement' on page 277 |
Test the most recently created definition by binding it to the specified data set | 'TEST Statement' on page 279 |
PROC TEMPLATE ;
Deletes the specified definition
DELETE definition-path ;
definition-path
specifies a definition to delete. A definition-path consists of one or more names , separated by periods. Each name represents a directory in a template store. (A template store is a type of SAS file.) If the same definition exists in multiple template stores, PROC TEMPLATE deletes the definition from the first template store in the current path where you have write access.
CAUTION:
Deleting a directory in a template store, deletes all subdirectories and definitions in the directory. If the path that you specify is a directory rather than a definition, PROC TEMPLATE deletes all the directories and all the definitions in that directory.
Creates a link to an existing definition
LINK definition-path-1 TO definition-path-2 </ option(s) >;
Creating a link to a definition has the same effect as creating a new definition that inherits its characteristics from another definition (see the discussion of PARENT= on page 419 option). However, using a link is more efficient than using inheritance because linking does not actually create a new definition.
Note: To maximize efficiency, PROC TEMPLATE implements any definition that consists solely of the declaration of a parent and of notes as a link.
definition-path-1
specifies the path of the definition to create. PROC TEMPLATE creates the definition in the first template store in the path that you can write to.
definition-path-2
specifies the path of the definition to link to. If the same definition exists in multiple template stores, PROC TEMPLATE uses the one from the first template store in the current path that you can read.
Tip: PROC TEMPLATE does not confirm that definition-path-2 exists when it compiles the definition.
NOTES= ' text '
specifies notes to store in the definition.
Requirement: You must enclose the text in quotation marks.
Tip: Notes of this type become part of the compiled definition, which you can view with the SOURCE statement, whereas SAS comments do not.
STORE= libref . template-store
specifies the location where the link will be created.
Restriction: The STORE= option syntax does not become part of the compiled definition.
Tip: The link always points to the first definition with the same name that it finds in the ODS path.
Lists the definitions in one or more template stores
Featured in: Example 1 on page 281
LIST < starting-path ></ option(s) >;
starting-path
specifies a level within each template store where PROC TEMPLATE starts listing definitions. For example, if starting-path is base.univariate , PROC TEMPLATE lists only base.univariate and the items within it and within all the levels that it contains.
Default: If you do not specify a starting-path , then the LIST statement lists all definitions in all template stores unless the ODS PATH statement is used to confine the search to the specified template stores.
Restriction: This option must precede the forward slash (/) in the LIST statement.
SORT = statistic < sorting-order >
sorts the list of definitions by the specified statistic in the specified sorting order.
statistic
can be one of the following:
CREATED
is the date that the definition was created.
NOTES
is the content of any NOTES statement in the PROC TEMPLATE step that created the item.
Alias: LABEL
LINK
is the name of the definition that the current definition links to (see 'LINK Statement' on page 273).
PATH
is the path to the current definition in the template store. (The path does not include the name of the template store).
SIZE
is the size of the definition.
TYPE
is the type of definition: COLUMN, FOOTER, HEADER, STYLE, TABLE, or LINK. If the item is not a definition, but simply a level in the item store, its type is DIR.
Default: PATH
sorting-order
specifies whether SORT= sorts from low values to high values or from high values to low values.
ASCENDING
sorts from low values to high values.
Alias: A
DESCENDING
sorts from high values to low values.
Alias: D
Default: ASCENDING
STATS=ALL (statistic-1 <, statistic-n>)
specifies the information to include in the list of definitions.
ALL
includes all available information.
(statistic-1 <, statistic-n>)
includes the specified information. statistic can be one or more of the following:
CREATED
is the date that the definition was created.
NOTES
is the content of any NOTES statement in the PROC TEMPLATE step that created the item.
Alias: LABEL
LINK
is the name of the definition that the current definition links to (see 'LINK Statement' on page 273).
SIZE
is the size of the definition.
Default: Whether or not you specify STATS=, the list of definitions always includes an observation number, the path to the definition, and its type.
STORE= libref . template-store
specifies the template store to process.
Default: all template stores in the current template path (see 'PATH Statement' on page 276).
Specifies locations to write to or read from when you create or use PROC TEMPLATE definitions, and specifies the order in which to search for them. This statement overrides the ODS PATH statement for the duration of the PROC TEMPLATE step.
Featured in: Example 1 on page 281 and Example 2 on page 283
PATH <(APPEND) (PREPEND) (REMOVE) > location(s) ;
PATH path-argument ;
location(s)
specifies one or more locations to write to or read from when creating or using PROC TEMPLATE definitions and the order in which to search for them. ODS searches the locations in the order that they appear on the statement. It uses the first definition that it finds that has the appropriate access mode (read, write, or update) set.
Each location has the following form:
< libref. > item-store <(READ UPDATE WRITE)>
< libref .> item-store
identifies an item store to read from, to write to, or to update. If an item store does not already exist, then the PATH statement will create it.
(READ UPDATE WRITE)
specifies the access mode for the definition. An access mode is one of the following:
READ
provides read-only access.
WRITE
provides write access (always creating a new template store) as well as read access.
UPDATE
provides update access (creating a new template store only if the specified one does not exist) as well as read access.
Default: READ
Default:
SASUSER.TEMPLAT (UPDATE)
SASHELP.TMPLMST (READ)
Note: SAS stores all the definitions that it provides in SASHELP.TMPLMST.
Tip: If you want to be able to ignore all the definitions that you create, then keep them in their own item stores so that you can leave them out of the list of item stores that ODS searches.
path-argument
sets or displays the ODS path.
path-argument can be one of the following:
RESET
sets the ODS path to the default settings SASUSER.TEMPLAT (UPDATE) and SASHELP.TMPLMST (READ).
SHOW
displays the current ODS path.
VERIFY
sets the ODS path to include only templates supplied by SAS. VERIFY is the same as specifying ODS PATH SASHELP.TMPLMST (READ).
(APPEND PREPEND REMOVE )
adds one or more locations to a path, or removes one or more locations from a path.
APPEND
adds one or more locations to the end of a path. When you append a location to a path, all duplicate instances (with the same name and same permissions) of that item store are removed from the path. Only the last item store with the same name and permissions are kept.
PREPEND
adds one or more locations to the beginning of a path. When you prepend a location to a path, all duplicate instances (with the same name and same permissions) of that item store are removed from the path. Only the first item store with the same name and permissions are kept.
REMOVE
removes one or more locations from a path.
Default: If you do not specify an APPEND, PREPEND, or REMOVE option, then the PATH statement overwrites the complete path.
Writes the source code for the specified definition to the SAS log
Featured in: Example 2 on page 283
SOURCE definition-path </ option(s) >;
definition-path
specifies the path of the definition that you want to write to the SAS log. If the same definition exists in multiple template stores, PROC TEMPLATE uses the one from the first template store that you can read in the current path.
Tip: PROC TEMPLATE stores definitions in compiled form. The SOURCE statement actually decompiles the definition. Because SAS comments are not compiled, comments that are in the source code do not appear when you decompile the definition. If you want to annotate your definition, use the NOTES statement inside the definition or the block of editing instructions, or use the NOTES= option in the LINK statement. These notes do become part of the compiled definition. (See 'NOTES Statement' on page 429 and the discussion of the NOTES= option on page 274. You can also specify notes as quoted strings in the DYNAMIC, MVAR, NMVAR, REPLACE, and STYLE statements.)
FILE= ' file-specification ' fileref
specifies a file to write the definition to.
' file-specification '
is the name of an external file to write to.
Requirement: The external-file that you specify must be enclosed in quotation marks.
fileref
is a file reference that has been assigned to an external file. Use the FILENAME statement to assign a fileref. (For information on the FILENAME statement, see 'Statements' in SAS Language Reference: Dictionary .)
Default: If you do not specify a filename where you want the source code written, then the SOURCE statement writes the source code to the SAS log.
NOFOLLOW
specifies that the program not resolve links in the PARENT= option, which specifies the definition that the current definition inherits from. For information about the PARENT= option, see the PARENT= option in the styles attribute section.
STORE= libref.template-store
specifies the template store where the definition is located.
Interaction: In most cases, the STORE= option is added to the definition statement when PROC TEMPLATE displays the source code. However, if the template store specified in the STORE= option is in the ODS path with only read permission, then PROC TEMPLATE does not include the STORE= option in the source code that it displays. There will be no STORE= option, which means that if you run the code, then the definition that it creates will go to the first template store in your ODS path that has update permission.
Tests the most recently created definition by binding it to the specified data set
TEST DATA= SAS-data-set </ STORE= libref . template-store >;
DATA= SAS-data-set
specifies the data set to bind to the most recently created definition. ODS sends this output object to all open ODS destinations.
STORE= libref . template-store
specifies the template store where the definition is located.
Requirement: If you specify this option, then the template store that you specify must match the template store in the DEFINE statement that created the definition.