The combination of the fileref PRINT and the ODS option in the FILE statement routes the results of the DATA step to ODS. (For more information on using the DATA step with ODS, see Using the Output Delivery System in the DATA Step. The TEMPLATE= suboption tells ODS to use the table definition named table1, which was just created with PROC TEMPLATE.
   file print ods=(
        template='table1'