Chapter Contents |
Previous |
Next |
FILE, ODS |
Valid: | in a DATA step |
Category: | File-handling |
Type: | Executable |
Requirement: | If you use the ODS option, you must use the fileref PRINT in the FILE statement. |
Restriction: | The DELIMITER= and DSD options have no effect on the ODS option. You cannot use _FILE_=, FILEVAR=, HEADER=, or PAD with the ODS option. |
Syntax | |
Arguments | |
Options | |
ODS Suboptions | |
Details | |
See Also |
Syntax |
FILE PRINT <ODS<=(ODS-option(s))>><overflow-control><N=1 | pagesize>; |
Arguments |
Restriction: | You must use PRINT in a FILE statement that uses the ODS option. |
Options |
Alias: | PS |
Default: | If you do not specify
any suboptions, the DATA step uses a default template (base.datastep.table)
that is stored in the SASHELP data library. This template defines two generic
columns: one for character variables, and one for numeric variables. ODS associates
each variable in the DATA step with one of these columns and displays the
variables in the order in which they are defined in the DATA step.
Without suboptions, the default template uses the variable's label as its column header. If no label exists, the template uses the variable's name as the column header. |
Restriction: | You must use the fileref PRINT with the ODS option. |
Default: | FLOWOVER |
ODS Suboptions |
You can use any combination of the following suboptions with the ODS= option in the FILE statement:
To do this... | Use this suboption | |
---|---|---|
Specify one or more columns for the data component | COLUMNS= or VARIABLES= | |
Specify default values for column attributes that exist in the template but that get their values from the data component | DYNAMIC= | |
Assert that all column definitions in the template can or cannot be used by more than one variable | GENERIC= | |
Specify a column header to use for any column that does not have a column header specified in the COLUMNS= or VARIABLES= suboption | LABEL= | |
Specify a name for the output object that the DATA step produces | OBJECT= | |
Specify a label for the output object that the DATA step produces | OBJECTLABEL= | |
Specify the template to use with the data component to produce the output object | TEMPLATE= |
Note: By default, the order of the columns
in the output object is determined by their order in the template, not by
their order in the data component. You can override this order by using the
ORDER_DATA option in the PROC TEMPLATE step that creates the template. The
default DATA step template uses this option.
Each column-specification has this general form:
column-name<=variable-name><(attribute(s))>
Restriction: | column-name must conform to the rules for SAS variable names. The first character must be a letter or an underscore. Subsequent characters can be letters, numbers, or underscores. |
Tip: | You can use list notation
(for example, score1 -score5 ) to specify a range of column
names. |
Default: | If you omit variable-name, ODS looks for a DATA step variable named column-name to place in the specified column. If no such variable exists, ODS returns an error. |
Tip: | You can use list notation
(for example, score1 -score5 ) to specify a range of variable
names. |
Default: | ODS uses the first of
these formats for the variable that it finds:
|
Default: | If you do not specify COLUMNS= or VARIABLES=, the order of columns in the data component matches the order of the corresponding variables in the program data vector. |
Restriction: | You can use only one COLUMNS= suboption in a FILE statement. |
Interaction: | You can use either the COLUMNS= suboption or the VARIABLES= suboption to associate variables with columns. However, you cannot use both suboptions in the same FILE statement. |
A dynamic attribute value is defined in the template. Its name serves as a placeholder for the value that is supplied to the data component with the DYNAMIC= suboption. When ODS creates the output object from the template and the data component, it substitutes the appropriate value from the data component for the value's name in the template.
Each dynamic-specification has the following form:
dynamic-value-name<=variable-name | constant>
Default: | If you omit variable-name and constant, then the DATA step looks for a variable name that matches 'dynamic-value-name'. |
Tip: | By default, DYNAMIC= applies to all columns in the data component. You can override this specification for an individual column by specifying DYNAMIC= as an attribute for that column in the COLUMNS= or the VARIABLES= suboption. |
Default: | OFF |
Interaction: | If you do not specify a template (see TEMPLATE= ), GENERIC= is set to ON. |
Restriction: | To have ODS recognize the column names as a match, the GENERIC= specification must match the GENERIC= specification in the template that you are using. |
Tip: | By default, GENERIC= applies to all columns in the data component. You can override this specification for an individual column by specifying GENERIC= as an attribute for that column in the COLUMNS= or the VARIABLES= suboption. |
Default: | ODS uses for the column
header the first of these labels that it finds:
|
The Results window and the HTML contents file both contain a description of and a link to each output object. The description contains the first of these items that ODS finds:
FilePrint#
,
where # increases by 1 for each DATA step that you run in the
current SAS process without specifying an object name or an object label.
Restriction: | Object-name must conform to the rules for SAS variable names. For information on these rules, see "Appendix 1: Rules for Words and Names in the SAS Language" in SAS Language Reference: Dictionary. |
The Results window and the HTML contents file both contain a description of and a link to each output object. The description contains the first of these items that ODS finds:
FilePrint#
,
where # increases by 1 for each DATA step that you run in the
current SAS process without specifying an object name or an object
label.
Default: | The default template (base.datastep.table) that is stored in the SASUSER SAS data library. |
Interaction: | When you use the default template, GENERIC= is set to on for all columns in the data component. (See GENERIC=). |
Note: By default, the order of the columns
in the output object is determined by their order in the template, not by
their order in the data component. You can override this order by using the
ORDER_DATA option in the PROC TEMPLATE step that creates the template. The
default DATA step template uses this option.
Each variable-specification has this general form:
variable-name<=column-name><(attribute(s))>
Tip: | You can use list notation
(for example, score1 -score5 ) to specify a range of variable
names. |
Default: | If you omit column-name, ODS looks for a column in the template that is named variable-name and places the variable in that column. If no such column exists, ODS returns an error. |
Restriction: | Column-name must match a column name in the template that you are using. It must also conform to the rules for SAS variable names. For information on these rules, see "Appendix 1: Rules for Words and Names in the SAS Language" in SAS Language Reference: Dictionary. |
Tip: | You can use list notation
(for example, score1 -score5 ) to specify a range of column
names. |
Restriction: | You can use only one VARIABLES= suboption in a FILE statement. |
Interaction: | You can use either the COLUMNS= suboption or the VARIABLES= suboption to associate variables with columns. However, you cannot use both suboptions in the same FILE statement. |
Tip: | VARIABLES= is primarily for use with the default DATA step template. When you are using the default template, the DATA step can map variables to the appropriate column in the template so you don't need to specify a column name. |
Details |
Within the DATA step, the ODS option in the FILE statement and the _ODS_ option in the PUT statement provide connections with the Output Delivery System (ODS). You use both of these connections to route the results of a DATA step to ODS. By default, when the DATA step uses ODS, ODS writes output objects to the procedure output and places links to them in the Results folder. You can use global ODS statements to write to other ODS destinations.
The FILE and PUT statements interact in the following way:
The ODS destinations are controlled by the global ODS statements. You can use an existing template or create your own with the TEMPLATE. procedure.
For details on using the Output Delivery System, see The Complete Guide to the SAS Output Delivery System.
See Also |
Statements:
|
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.