Valid in: | DATA step |
Category: | File-handling |
Type: | Executable |
Default: | ODS sends the output object to all open ODS destinations. |
Note: | This syntax shows only the ODS form of the FILE statement. For the complete syntax, see FILE Statement in SAS Statements: Reference. |
You can use either the COLUMNS= suboption or the VARIABLES= suboption, but not both, in a single FILE PRINT ODS statement.
To override the default order, use the ORDER_DATA= table attribute in the PROC TEMPLATE step that creates the definition. The default DATA step table definition uses this attribute. For more information, see the discussion of ORDER_DATA=.
If you do not specify COLUMNS= or VARIABLES=, then the order of columns in the data component matches the order of the corresponding variables in the program data vector.
By default, the GENERIC= suboption applies to all columns in the data component.
The GENERIC= option in the DATA step is used in conjunction with the GENERIC= column attribute in the table template. See the GENERIC= column attribute in Column Attribute Statements.
If you do specify the TEMPLATE= suboption, ODS first looks for table-definition-name in Sasuser.Templat, and then it looks in Sashelp.Tmplmst.
You can change the locations in which ODS searches for the table-definition-name by using the ODS PATH statement.
If you use a table definition other than the default table definition and you omit column-name, ODS looks in the table definition for a column that is named variable-name and places the variable in that column. ODS returns an error if no such column exists.
You can use either the COLUMNS= suboption or the VARIABLES= suboption to associate variables with columns, but you cannot use both suboptions in the same FILE PRINT ODS statement.
The VARIABLES= suboption is for use primarily with the default DATA step table definition. When you use the default definition, the DATA step can map variables to the appropriate column in the definition so you do not need to specify a column name.
data _null_; set top3list; file print ods = ( template='means.topn' columns=( class=school(generic=on) class=year(generic=on) sum=moneyRaised_sum(generic=on) mean=moneyRaised_mean(generic=on) raised=moneyRaised_1(generic=on) raised=moneyRaised_2(generic=on) raised=moneyRaised_3(generic=on) name=name_1(generic=on) name=name_2(generic=on) name=name_3(generic=on) school=school_1(generic=on) school=school_2(generic=on) school=school_3(generic=on) year=year_1(generic=on) year=year_2(generic=on) year=year_3(generic=on) ) ); put _ods_; run;
data _null_;
set top3list;
file print ods = (
template='means.topn'
generic=on
columns=(
class=school
class=year
sum=moneyRaised_sum
mean=moneyRaised_mean
raised=moneyRaised_1
raised=moneyRaised_2
raised=moneyRaised_3
name=name_1
name=name_2
name=name_3
school=school_1
school=school_2
school=school_3
year=year_1
year=year_2
year=year_3
)
);
put _ods_;
run;