Styles tagsets

59
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 Gebhart Senior Systems Developer, SAS Institute

Transcript of Styles tagsets

Page 1: 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

Page 2: Styles tagsets

Proc TemplateA Framework

Page 3: Styles tagsets

proc template; list styles;run;

Page 4: Styles tagsets

proc template; list styles;run;

Page 5: Styles tagsets

proc template; list tagsets;run;

Page 6: Styles tagsets

proc template; list tagsets;run;

Page 7: Styles tagsets

Tagsets Are Collections of Event Definitions

Page 8: Styles tagsets

Tagsets Are Collections of Event Definitions

Page 9: Styles tagsets

Tagsets Are Collections of Event Definitions

Page 10: Styles tagsets

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

proc print data=sashelp.class; run;

ods _all_ close;

Page 11: Styles tagsets
Page 12: Styles tagsets

Header

Page 13: Styles tagsets
Page 14: Styles tagsets
Page 15: Styles tagsets

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

Page 16: Styles tagsets

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 ;

Page 17: Styles tagsets

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

Page 18: Styles tagsets

Tagsets Are Collections of Event Definitions

Page 19: Styles tagsets

Tagsets Are Collections of Event Definitions

Page 20: Styles tagsets

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

Page 21: Styles tagsets

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

proc print data=sashelp.class; run;

ods html close;

Page 22: Styles tagsets
Page 23: Styles tagsets
Page 24: Styles tagsets

Stylesheet=Example2.css

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

Page 25: Styles tagsets

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

proc print data=sashelp.class; run;

ods _all_ close;

Page 26: Styles tagsets

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

proc print data=sashelp.class; run;

ods _all_ close;

Page 27: Styles tagsets

stylesheet= "example3.xml";

Page 28: Styles tagsets

<stylesheet> <styles>

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

stylesheet= "example3.xml";

Page 29: Styles tagsets

file= "example3_map.xml”;

Page 30: Styles tagsets

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">

Page 31: Styles tagsets

Tagsets Are Collections of Events

Page 32: Styles tagsets

Tagsets Are Collections of Events

Page 33: Styles tagsets

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;

Page 34: Styles tagsets

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;

Page 35: Styles tagsets

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;

Page 36: Styles tagsets

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

proc print data=sashelp.class; run;

ods _all_ close;

Page 37: Styles tagsets

Example4a.xml

Page 38: Styles tagsets

Example4a.xml

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

Page 39: Styles tagsets

Example4a.xml

The Stylesheet

Entry

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

Page 40: Styles tagsets

Example4a.xml

The Stylesheet

Entry

The Table

Event

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

Page 41: Styles tagsets

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;

Page 42: Styles tagsets

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;

Page 43: Styles tagsets

Header and Data Events

21

Page 44: Styles tagsets

Header and Data Events

21

Page 45: Styles tagsets

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

ods _all_ close;

Page 46: Styles tagsets

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

Page 47: Styles tagsets
Page 48: Styles tagsets

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

Page 49: Styles tagsets

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;

Page 50: Styles tagsets

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

Page 51: Styles tagsets

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

Page 52: Styles tagsets
Page 53: Styles tagsets

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

Page 54: Styles tagsets

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;

Page 55: Styles tagsets

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;

Page 56: Styles tagsets

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;

Page 57: Styles tagsets
Page 59: 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.