The programs in this section show the PROC TEMPLATE steps that were used in 'About Style Definition Inheritance and Style Element Inheritance' on page 322 to illustrate inheritance in style definitions. These programs also show the SAS code that uses the style definitions.
This program generates the HTML output in Display 9.3 on page 324.
ods path sashelp.tmplmst(read) sasuser.templat(update); title; options nodate pageno=1 linesize=72 pagesize=60; data test; input country $ 1-13 grain $ 15-18 kilotons; datalines; Brazil Rice 10035 China Rice 190100 India Rice 120012 Indonesia Rice 51165 United States Rice 7771 ; proc template; define table mytable; column x y z; define x; style=celldatasimple; dataname=country; header='Country'; end; define y; style=celldatasimple; dataname=grain; header='Grain'; end; define z; style=celldatasimple; dataname=kilotons; header='Kilotons'; end; end; run; proc template; /* to ensure a fresh start with the styles */ delete concepts.style1; delete concepts.style2; run; proc template; define style concepts.style1; style celldatasimple / font_face=arial background=very light vivid blue foreground=white; end; run; ods html3 body='display1-body.htm' style=concepts.style1; data _null_; set test; file print ods=(template='mytable'); put _ods_; run; ods html3 close;
This program generates the HTML output in Creating a Second Style Element Independently or from an Existing Style Element on page 324. In this version of the code, the style element celldataemphasis is created independently of celldatasimple .
ods path sashelp.tmplmst(read) sasuser.templat(update); title; options nodate pageno=1 linesize=72 pagesize=60; data test; input country $ 1-13 grain $ 15-18 kilotons; datalines; Brazil Rice 10035 China Rice 190100 India Rice 120012 Indonesia Rice 51165 United States Rice 7771 ; proc template; define table mytable; column x y z; define x; style=celldatasimple; dataname=country; header='Country'; end; define y; style=celldataemphasis; dataname=grain; header='Grain'; end; define z; style=celldatasimple; dataname=kilotons; header='Kilotons'; end; end; run; proc template; /* to ensure a fresh start with the styles */ delete concepts.style1; delete concepts.style2; run; proc template; define style concepts.style1; style celldatasimple / font_face=arial background=very light vivid blue foreground=white; style celldataemphasis from celldatasimple / foreground=blue font_style=italic; end; run; ods html3 body='display2-body.htm' style=concepts.style1; data _null_; set test; file print ods=(template='mytable'); put _ods_; run; ods html3 close;
This program generates the HTML output in Creating a Second Style Element Independently or from an Existing Style Element on page 324. In this version of the code, the style element celldataemphasis is created as a child of celldatasimple .
ods path sashelp.tmplmst(read) sasuser.templat(update); title; options nodate pageno=1 linesize=72 pagesize=60; data test; input country $ 1-13 grain $ 15-18 kilotons; datalines; Brazil Rice 10035 China Rice 190100 India Rice 120012 Indonesia Rice 51165 United States Rice 7771 ; proc template; define table mytable; column x y z; define x; style=celldatasimple; dataname=country; header='Country'; end; define y; style=celldataemphasis; dataname=grain; header='Grain'; end; define z; style=celldatasimple; dataname=kilotons; header='Kilotons'; end; end; run; proc template; /* to ensure a fresh start with the styles */ delete concepts.style1; delete concepts.style2; run; proc template; define style concepts.style1; style celldatasimple / font_face=arial background=very light vivid blue foreground=white; style celldataemphasis from celldatasimple / foreground=blue font_style=italic; end; run; ods html3 body='display2-body.htm' style=concepts.style1; data _null_; set test; file print ods=(template='mytable'); put _ods_; run; ods html3 close;
This program generates the HTML output in Display 9.5 on page 327.
ods path sashelp.tmplmst(read) sasuser.templat(update); title; options nodate pageno=1 linesize=72 pagesize=60; data test; input country $ 1-13 grain $ 15-18 kilotons; datalines; Brazil Rice 10035 China Rice 190100 India Rice 120012 Indonesia Rice 51165 United States Rice 7771 ; proc template; define table mytable; column x y z; define x; style=celldatasimple; dataname=country; header='Country'; end; define y; style=celldataemphasis; dataname=grain; header='Grain'; end; define z; style=celldatasimple; dataname=kilotons; header='Kilotons'; end; end; run; proc template; /* to ensure a fresh start with the styles */ delete concepts.style1; delete concepts.style2; run; proc template; define style concepts.style1; style celldatasimple 'The change to FONT_FACE does not affect celldataemphasis.' / font_face=times background=very light vivid blue foreground=white; style celldataemphasis / font_face=arial background=very light vivid blue foreground=blue font_style=italic; end; run; ods html3 body='display3-body.htm' style=concepts.style1; data _null_; set test; file print ods=(template='mytable'); put _ods_; run; ods html3 close;
This program generates the HTML output in Display 9.6 on page 327. In this version of the code, the style element celldataemphasis is created as a child of celldatasimple .
ods path sashelp.tmplmst(read) sasuser.templat(update); title; options nodate pageno=1 linesize=72 pagesize=60; data test; input country $ 1-13 grain $ 15-18 kilotons; datalines; Brazil Rice 10035 China Rice 190100 India Rice 120012 Indonesia Rice 51165 United States Rice 7771 ; proc template; define table mytable; column x y z; define x; style=celldatasimple; dataname=country; header='Country'; end; define y; style=celldataemphasis; dataname=grain; header='Grain'; end; define z; style=celldatasimple; dataname=kilotons; header='Kilotons'; end; end; run; proc template; /* to ensure a fresh start with the styles */ delete concepts.style1; delete concepts.style2; run; proc template; define style concepts.style1; style celldatasimple 'The change to FONT_FACE is passed to celldataemphasis, which inherits all the attributes of celldatasimple.' / font_face=times background=very light vivid blue foreground=white; style celldataemphasis from celldatasimple / foreground=blue font_style=italic; end; run; ods html3 body='display4-body.htm' style=concepts.style1; data _null_; set test; file print ods=(template='mytable'); put _ods_; run; ods html3 close;
This program generates the HTML output in Adding the Style Element celldatalarge on page 328.
ods path sashelp.tmplmst(read) sasuser.templat(update); title; options nodate pageno=1 linesize=72 pagesize=60; data test; input country $ 1-13 grain $ 15-18 kilotons; datalines; Brazil Rice 10035 China Rice 190100 India Rice 120012 Indonesia Rice 51165 United States Rice 7771 ; proc template; define table mytable; column x y z; define x; style=celldatasimple; dataname=country; header='Country'; end; define y; style=celldataemphasis; dataname=grain; header='Grain'; end; define z; style=celldatalarge; dataname=kilotons; header='Kilotons'; end; end; run; proc template; /* to ensure a fresh start with the styles */ delete concepts.style1; delete concepts.style2; run; proc template; define style concepts.style1; style celldatasimple / font_face=arial background=very light vivid blue foreground=white; style celldataemphasis from celldatasimple / foreground=blue font_style=italic; style celldatalarge from celldataemphasis / font_weight=bold font_size=5; end; run; ods html3 body='display5-body.htm' style=concepts.style1; data _null_; set test; file print ods=(template='mytable'); put _ods_; run; ods html3 close;
This program generates the HTML output in Creating a New Style Element from a Style Element in the Parent Style Definition on page 333.
ods path sashelp.tmplmst(read) sasuser.templat(update); title; options nodate pageno=1 linesize=72 pagesize=60; data test; input country $ 1-13 grain $ 15-18 kilotons; datalines; Brazil Rice 10035 China Rice 190100 India Rice 120012 Indonesia Rice 51165 United States Rice 7771 ; proc template; define table mytable; column x y z w; define x; style=celldatasimple; dataname=country; header='Country'; end; define y; style=celldataemphasis; dataname=grain; header='Grain'; end; define z; style=celldatalarge; dataname=kilotons; header='Kilotons'; end; define w; style=celldatasmall; dataname=kilotons; header='Kilotons'; end; end; run; proc template; /* to ensure a fresh start with the styles */ delete concepts.style1; delete concepts.style2; run; proc template; define style concepts.style1; style celldatasimple / font_face=arial background=very light vivid blue foreground=white; style celldataemphasis from celldatasimple / foreground=blue font_style=italic; style celldatalarge from celldataemphasis / font_weight=bold font_size=5; end; run; proc template; define style concepts.style2; parent=concepts.style1; style celldatasmall from celldatalarge / font_size=2; end; run; ods html3 body='display6-body.htm' style=concepts.style2; data _null_; set test; file print ods=(template='mytable'); put _ods_; run; ods html3 close;
This program generates the HTML output in Display 9.9 on page 335.
ods path sashelp.tmplmst(read) sasuser.templat(update); title; options nodate pageno=1 linesize=72 pagesize=60; data test; input country $ 1-13 grain $ 15-18 kilotons; datalines; Brazil Rice 10035 China Rice 190100 India Rice 120012 Indonesia Rice 51165 United States Rice 7771 ; proc template; define table mytable; column x y z w; define x; style=celldatasimple; dataname=country; header='Country'; end; define y; style=celldataemphasis; dataname=grain; header='Grain'; end; define z; style=celldatalarge; dataname=kilotons; header='Kilotons'; end; define w; style=celldatasmall; dataname=kilotons; header='Kilotons'; end; end; run; proc template; /* to ensure a fresh start with the styles */ delete concepts.style1; delete concepts.style2; run; proc template; define style concepts.style1; style celldatasimple / font_face=times background=very light vivid blue foreground=white; style celldataemphasis from celldatasimple / foreground=black font_style=italic; style celldatalarge from celldataemphasis / font_weight=bold font_size=5; end; run; proc template; define style concepts.style2; parent=concepts.style1; style celldataemphasis from celldataemphasis / background=white; style celldatasmall from celldatalarge / font_size=2; end; run; ods html3 body='display7-body.htm' style=concepts.style2; data _null_; set test; file print ods=(template='mytable'); put _ods_; run; ods html3 close;
This program generates the HTML output in Display 9.10 on page 337.
ods path sashelp.tmplmst(read) sasuser.templat(update); title; options nodate pageno=1 linesize=72 pagesize=60; data test; input country $ 1-13 grain $ 15-18 kilotons; datalines; Brazil Rice 10035 China Rice 190100 India Rice 120012 Indonesia Rice 51165 United States Rice 7771 ; proc template; define table mytable; column x y z w; define x; style=celldatasimple; dataname=country; header='Country'; end; define y; style=celldataemphasis; dataname=grain; header='Grain'; end; define z; style=celldatalarge; dataname=kilotons; header='Kilotons'; end; define w; style=celldatasmall; dataname=kilotons; header='Kilotons'; end; end; run; proc template; /* to ensure a fresh start with the styles */ delete concepts.style1; delete concepts.style2; run; proc template; define style concepts.style1; style celldatasimple / font_face=arial background=very light vivid blue foreground=white; style celldataemphasis from celldatasimple / foreground=blue font_style=italic; style celldatalarge from celldataemphasis / font_weight=bold font_size=5; end; run; proc template; define style concepts.style2; parent=concepts.style1; style celldataemphasis from celldataemphasis / background=white; style celldatasmall from celldatalarge / font_size=2; end; run; ods html3 body='display8-body.htm' style=concepts.style2; data _null_; set test; file print ods=(template='mytable'); put _ods_; run; ods html3 close;
This program generates the HTML output in Display 9.11 on page 341.
ods path sashelp.tmplmst(read) sasuser.templat(update); title; options nodate pageno=1 linesize=72 pagesize=60; data test; input country $ 1-13 grain $ 15-18 kilotons; datalines; Brazil Rice 10035 China Rice 190100 India Rice 120012 Indonesia Rice 51165 United States Rice 7771 ; proc template; define table mytable; column x y z w; define x; style=celldatasimple; dataname=country; header='Country'; end; define y; style=celldataemphasis; dataname=grain; header='Grain'; end; define z; style=celldatalarge; dataname=kilotons; header='Kilotons'; end; define w; style=celldatasmall; dataname=kilotons; header='Kilotons'; end; end; run; proc template; /* to ensure a fresh start with the styles */ delete concepts.style1; delete concepts.style2; run; proc template; define style concepts.style1; style celldatasimple / font_face=arial background=very light vivid blue foreground=white; style celldataemphasis from celldatasimple / foreground=blue font_style=italic; style celldatalarge from celldataemphasis / font_weight=bold font_size=5; end; run; proc template; define style concepts.style2; parent=concepts.style1; replace celldataemphasis from celldatasimple / foreground=blue font_style=italic background=white; style celldatasmall from celldatalarge / font_size=2; end; run; ods html3 body='display9-body.htm' style=concepts.style2; data _null_; set test; file print ods=(template='mytable'); put _ods_; run; ods html3 close;