brooke kinniburgh vansug november 30, 2016 · 'fixedfont' = (", courier,...

22
Brooke Kinniburgh VANSUG November 30, 2016

Upload: trancong

Post on 17-Apr-2018

231 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

Brooke Kinniburgh

VANSUG November 30, 2016

Page 2: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

2

• Set of formatting options for SAS job

– Colours, fonts, font size, graph components, line

thickness, etc.

• SAS ships with multiple built-in STYLEs:– proc template; list styles; run;

– To see what they look like: http://www.sascommunity.org/mwiki/images/6/66/SAS_Styles_-

_updated_for_SAS_9dot2.pdf

– http://support.sas.com/documentation/cdl/en/odsug/67921/HTML/default/view

er.htm#p14qidvs5xf7omn14ommvsuhvmzn.htm

Page 3: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

3

Page 4: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

4

• Nice as they are, unlikely these templates match

your agency style guide

• Use PROC TEMPLATE to create your own

STYLE that you can use every time!

• READ THIS SAS GF 2010 Paper BEFORE

YOU START:

Page 5: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

5

• Start from scratch (why?????)

• Modify a SAS STYLE

1. Use source code as your backbone

2. UNDERSTAND and THEN edit with PROC

TEMPLATE

3. Save as a .sas file

4. %include and use in your SAS session

5. Create fancy reports, impress your friends and

colleagues, etc.

Page 6: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

6

• Colours are specified as HEX RGB codes:

– CXrrggbb

– CX000000 = black (no colour)

– CXFFFFFF = white (all colours)

– CXFF0000 = red (100% red, no green, no blue)

• Many lookup tools for hex codes (e.g. http://www.color-hex.com/)

• Can also use names from SAS colour table: http://support.sas.com/documentation/cdl/en/graphref/

67881/HTML/default/viewer.htm#n161ukdyz9wpfsn1n

h8sihforvyq.htm

Page 7: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

7

style color_list/

'fgD1' = cx666666 /*(grey 40 – medium)*/

'fgC1' = cxCCCCCC /*(grey 80 – pale)*/

'fgB1' = cx000000 /*(black)*/

'bgA1' = cx6495ED /*(cornflower blue)*/

'fgA' = cx003399 /*(medium blue)*/

'bgA' = cxffffff /*(white)*/;

style color

'headerfg' = color_list('bgA') 'headerbg' = color_list('bgA1')

'datafg' = color_list('fgB1') 'databg' = color_list('bgA');

Fg = foreground (i.e. text); bg = background

Page 8: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

8

style color_list/

'fgD1' = cx666666 /*(grey 40 – medium)*/ 'fgC1' = cxCCCCCC /*(grey 80 – pale)*/

'fgB1' = cx000000 /*(black)*/ 'bgA1' = cx6495ED /*(cornflower blue)*/

'fgA' = cx003399 /*(medium blue)*/ ‘bgA' = cxffffff /*(white)*/;

style color

'headerfg' = color_list('bgA') 'headerbg' = color_list('bgA1')

'datafg' = color_list('fgB1') 'databg' = color_list('bgA');

Translation:

• Header backgrounds are cornflower blue (bgA1)

• Header foreground (text) is white (bgA)

• Data backgrounds are white (bgA)

• Data text is black (fgB1)

Page 9: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

9

• Makes sense when you look at a sample table

from sasweb style:

bgA1 (blue)

bgA (white)

fgB1 (black)

Page 10: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

10

style fonts/ 'docFont' = ("Arial",2pt)

style color_list/

'fgA' = cx003399 'bgA' = cxffffff

style colors/

'docfg' =color_list('fgA')

'docbg' =color_list('bgA')

style SystemFooter from TitlesAndFooters

"Controls system footer text." /

color = colors('docfg')

backgroundcolor = colors('docbg')

font = Fonts('docFont');

Page 11: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

11

proc template; source styles.sasweb; run;

Information will be displayed in your LOGdefine style Styles.Sasweb;

style fonts /'TitleFont2' = ("<sans-serif>, Helvetica, sans-serif",2,bold italic)'TitleFont' = ("<sans-serif>, Helvetica, sans-serif",4,bold)'StrongFont' = ("<sans-serif>, Helvetica, sans-serif",2,bold)'EmphasisFont' = ("<sans-serif>, Helvetica, sans-serif",2,italic)'FixedEmphasisFont' = ("<monospace>, Courier, monospace",2,italic)'FixedStrongFont' = ("<monospace>, Courier, monospace",2,bold)'FixedHeadingFont' = ("<monospace>, Courier, monospace",2)'BatchFixedFont' = ("SAS Monospace, <monospace>, Courier, monospace",2)'FixedFont' = ("<monospace>, Courier, monospace",2)'headingEmphasisFont' = ("<sans-serif>, Helvetica, sans-serif",2,bold italic)'headingFont' = ("<sans-serif>, Helvetica, sans-serif",2,bold)'docFont' = ("<sans-serif>, Helvetica, sans-serif",2);

class GraphFonts /'GraphDataFont' = ("<sans-serif>, <MTsans-serif>",7pt)'GraphUnicodeFont' = ("<MTsans-serif-unicode>",9pt)'GraphValueFont' = ("<sans-serif>, <MTsans-serif>",9pt)'GraphLabel2Font' = ("<sans-serif>, <MTsans-serif>",10pt)

...

...

end; run;

Copy ALL of this to a NEW SAS file and save

Page 12: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

12

Page 13: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

13

proc template;

define style Styles.PSBC;

style fonts/

'TitleFont2'=("Arial",14pt,bold) /* Procedure titles ("The

xx Procedure")*/

'TitleFont'=("Arial",14pt,bold) /* Titles from TITLE

statements */

'headingFont'=("Arial",10pt,bold) /* Table column and row

headings */

'docFont'=("Arial",10pt) /* Data in table cells */

'footFont'=("Arial",8pt) /* FOOTNOTE statements */

Page 14: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

14

style color_list "Colors used in the default style" /

'bgA'=cxffffff /*main background colour - WHITE*/

'bgA1'=cx2c2c6b /*background - DARK BLUE Pantone 282C*/

'bgb1'=cx99cc63 /*background - green Pantone 367C*/

style colors "Abstract colors used in the default style" /

'headerfg'=color_list('bgA') /*header text=white*/

'headerbg'=color_list('bgA1') /*header bg=dark blue*/

Page 15: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

15

• Headingfont is bold and

Arial

• Headerfg is white

• Headerbg is dark blue

• Docfont is Arial not bold

• Great!

Page 16: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

16

1. Add to colour_list:'dkblue'=cx2c2c6b /*DARK BLUE Pantone 282C*/

'green1'=cx99cc63 /*pantone 367C*/

'ltpurp1'=cxa6a5c5 /*pantone 7745C*/

'blue2'=cx3d6ecf /*secondary blue*/ ETC

2. Assign to graphcolours values:style graphcolors/

'gdata1'=color_list('green1') 'gcdata1'=color_list('green1')

'gdata2'=color_list('dkblue') 'gcdata2'=color_list('dkblue') ETC

3. Inheritance will take care of the reststyle GraphData1 from GraphComponent /

markersymbol="circlefilled" markersize=10px linestyle=1

contrastcolor=GraphColors('gcdata1') color=GraphColors('gdata1');

Page 17: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

17

SAS-created graphs in

our style guide!

Page 18: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

18

ods path(prepend)

work.templat(update);

proc template;

define style Styles.PSBC;

<lots and lots of code>

end;

run;

Code MUST start with this

Page 19: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

19

%include

"O:\...\style\PSBC template_20140507.sas";

• Then invoke your style as usual:

ods pdf file="&path.filename.pdf" style=psbc;

Page 20: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

20

• Read Cynthia Zender’s paper

• Start with the style closest to your desired

output

– Make the minimum number of changes

• Do NOT change the name of any of the style

attributes (docfont, bgA1, fgA, etc.).

• Comment, comment, comment in your STYLE

file

– Function of style elements for easier reference

– Note your changes (easier to fix what you know you

changed).

Page 21: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold

21

SAS® Style Templates: Always in Fashion

https://support.sas.com/resources/papers/proceedings10/033-

2010.pdf

SAS with Style: Creating your own ODS Style Template

http://www2.sas.com/proceedings/sugi28/195-28.pdf

Line styles:

http://support.sas.com/documentation/cdl/en/grstatgraph/63878/HT

ML/default/viewer.htm#n13pm0ndse66l2n1u309543mx2yt.htm

Symbol options:

https://support.sas.com/documentation/cdl/en/graphref/63022/HTML

/default/viewer.htm#symbolchap.htm

Page 22: Brooke Kinniburgh VANSUG November 30, 2016 · 'FixedFont' = (", Courier, monospace",2) 'headingEmphasisFont' = (", Helvetica, sans-serif",2,bold