Styles tagsets

Post on 29-Jun-2015

242 views 0 download

Tags:

Transcript of Styles tagsets

Copyright © 2007, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

ODS Markup, Tagsets and Styles!Taming ODS Styles and Tagsets.

Eric GebhartSenior Systems Developer, SAS Institute

Proc TemplateA Framework

proc template; list styles;run;

proc template; list styles;run;

proc template; list tagsets;run;

proc template; list tagsets;run;

Tagsets Are Collections of Event Definitions

Tagsets Are Collections of Event Definitions

Tagsets Are Collections of Event Definitions

ods tagsets.style_display file="exampleA.html";

proc print data=sashelp.class; run;

ods _all_ close;

Header

ods tagsets.odsstyle stylesheet= "exampleB.tpl";

ods tagsets.odsstyle stylesheet= "exampleB.tpl";

style Header/ Background = #B0B0B0 Foreground = #0033AA ContentPosition = left Font = ("Arial, Helvetica, sans-serif", 4, bold normal) ContentScrollbar = auto BodyScrollbar = auto ;

style HeaderEmphasis/ Background = #B0B0B0 Foreground = #0033AA ContentPosition = left Font = ("Arial, Helvetica, sans-serif", 3, normal italic) ContentScrollbar = auto BodyScrollbar = auto ;

style HeaderEmphasisFixed/ Background = #B0B0B0 Foreground = #0033AA ContentPosition = left Font = ("Courier New, Courier, monospace", 2, normal italic) ContentScrollbar = auto BodyScrollbar = auto ;

style HeaderEmpty/ Background = #B0B0B0 Foreground = #0033AA ContentPosition = left Font = ("Arial, Helvetica, sans-serif", 4, bold normal) ContentScrollbar = auto BodyScrollbar = auto ;

style HeaderFixed/ Background = #B0B0B0 Foreground = #0033AA ContentPosition = left Font = ("Courier New, Courier", 2, normal normal) ContentScrollbar = auto BodyScrollbar = auto ;

ods tagsets.odsstyle stylesheet= "exampleB.tpl";

Tagsets Are Collections of Event Definitions

Tagsets Are Collections of Event Definitions

proc template; define style styles.mystyle; style table / borderwidth = 1 bordercolor = red color = blue ; end;run;

ods html file="example2.html" stylesheet="example2.css" style=mystyle;

proc print data=sashelp.class; run;

ods html close;

Stylesheet=Example2.css

.table{ color: #0000FF; border-width: 1px; border-color: #FF0000;}

ods html file="example2.html" stylesheet="example2.css" style=mystyle;

proc print data=sashelp.class; run;

ods _all_ close;

ods tagsets.tpl_style_map file="example3_map.xml" stylesheet="example3.xml" style=mystyle;

proc print data=sashelp.class; run;

ods _all_ close;

stylesheet= "example3.xml";

<stylesheet> <styles>

<style_class class="table"> </style_class> </styles> <shortstyles/></stylesheet>

stylesheet= "example3.xml";

file= "example3_map.xml”;

file= "example3_map.xml”;

<proc_branch class="ContentProcName" name="Print" label="The Print Procedure" value="Print"> <leaf class="ContentItem" name="Print" label="Data Set SASHELP.CLASS" value="Data Set SASHELP.CLASS"> <page_anchor class="PagesItem"/> <output name="Print" label="Data Set SASHELP.CLASS">

<table class="table">

<table_headers class="table">

<table class="table">

Tagsets Are Collections of Events

Tagsets Are Collections of Events

define tagset tagsets.show_style;

embedded_stylesheet=yes;

define event style_class; put "Event: " event_name nl; putvars style _name_ " : " _value_ nl; put "=====================" nl; end;

define event table; put "Event: " event_name nl; putvars style _name_ " : " _value_ nl; put "=====================" nl; end;

end;

define tagset tagsets.show_style;

embedded_stylesheet=yes;

define event style_class; put "Event: " event_name nl; putvars style _name_ " : " _value_ nl; put "=====================" nl; end;

define event table; put "Event: " event_name nl; putvars style _name_ " : " _value_ nl; put "=====================" nl; end;

end;

define tagset tagsets.show_style;

embedded_stylesheet=yes;

define event style_class; put "Event: " event_name nl; putvars style _name_ " : " _value_ nl; put "=====================" nl; end;

define event table; put "Event: " event_name nl; putvars style _name_ " : " _value_ nl; put "=====================" nl; end;

end;

ods tagsets.show_style file="example4a.txt" style=mystyle;

proc print data=sashelp.class; run;

ods _all_ close;

Example4a.xml

Example4a.xml

Event: style_classCLASS : tableBORDERWIDTH : 1pxFOREGROUND : #0000FFBORDERCOLOR : #FF0000FRAMEBORDER : autoCONTENTSCROLLBAR : autoBODYSCROLLBAR : auto==================Event: tableCLASS : tableFRAMEBORDER : autoCONTENTSCROLLBAR : autoBODYSCROLLBAR : auto==================

Example4a.xml

The Stylesheet

Entry

Event: style_classCLASS : tableBORDERWIDTH : 1pxFOREGROUND : #0000FFBORDERCOLOR : #FF0000FRAMEBORDER : autoCONTENTSCROLLBAR : autoBODYSCROLLBAR : auto==================Event: tableCLASS : tableFRAMEBORDER : autoCONTENTSCROLLBAR : autoBODYSCROLLBAR : auto==================

Example4a.xml

The Stylesheet

Entry

The Table

Event

Event: style_classCLASS : tableBORDERWIDTH : 1pxFOREGROUND : #0000FFBORDERCOLOR : #FF0000FRAMEBORDER : autoCONTENTSCROLLBAR : autoBODYSCROLLBAR : auto==================Event: tableCLASS : tableFRAMEBORDER : autoCONTENTSCROLLBAR : autoBODYSCROLLBAR : auto==================

define tagset tagsets.show_style; embedded_stylesheet=yes;

define event header; trigger show_style; end;

define event data; trigger show_style; end; define event show_style; put "Event: " event_name nl; put "Value: " value nl; putvars style _name_ " : " _value_ nl; put "======================" nl; end; end;

define tagset tagsets.show_style; embedded_stylesheet=yes;

define event header; trigger show_style; end;

define event data; trigger show_style; end; define event show_style; put "Event: " event_name nl; put "Value: " value nl; putvars style _name_ " : " _value_ nl; put "======================" nl; end; end;

Header and Data Events

21

Header and Data Events

21

ods tagsets.show_style file="example13.txt";ods html file="example13.html";

ods _all_ close;

Options obs=1;proc print data=sashelp.class noobs; var name /style (header) = [foreground=red]; var age /style (data) = [foreground=green];run;

Event: headerValue: NameCLASS : HeaderFOREGROUND : #FF0000===================Event: headerValue: AgeCLASS : Header====================Event: dataValue: AlfredCLASS : Data====================Event: dataValue: 14CLASS : DataFOREGROUND : #008000====================

define style styles.mydefault; parent = styles.default;

style red_header from header / foreground=red tagattr="Show this!" ; style green_data from data / foreground=green tagattr="!!!!!!" ; end;

proc print data=sashelp.class noobs; var name /style (header) = [foreground=red]; var age /style (data) = [foreground=green];run;

proc print data=sashelp.class noobs; var name /style (header)=red_header; var age /style (data) = green_header;run;

Event: headerValue: NameCLASS : red_headerTAGATTR : Show This!===================Event: headerValue: AgeCLASS : Header====================Event: dataValue: AlfredCLASS : Data====================Event: dataValue: 14CLASS : green_dataTAGATTR : !!!!!!====================

ods tagsets.excelxp file="example15.xls" style=myjournal;

Bar size 2048

ods _all_ close;

define style styles.myjournal; parent = styles.Journal; style angle_header from header / tagattr = 'rotate:45' ; end; run;

ods tagsets.excelxp file="example15.xls" style=myjournal;

Bar size 2048

ods _all_ close;

define style styles.myjournal; parent = styles.Journal; style angle_header from header / tagattr = 'rotate:45' ; end; run;

proc tabulate data=sashelp.class order=data missing format=8.0 noseps formchar=', '; by sex;

class age sex name;

classlev name /s=angle_header;

var height weight; title; table age, name=' '*(height=' '*median=' '*F=5.3); run;

Bar size 2048

ods _all_ close;

ods tagsets.excelxp file="example15.xls" style=myjournal;

Copyright © 2007, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.