Valid in: | Anywhere |
Category: | Output Control |
See: | TITLE Statement under Windows, UNIX, or z/OS |
You can create titles that contain blank lines between the lines of text. For example, if you specify text with a TITLE statement and a TITLE3 statement, there will be a blank line between the two lines of text.
cm | Centimeters |
em | Standard typesetting measurement unit for width |
ex | Standard typesetting measurement unit for height |
in | Inches |
mm | Millimeters |
pt | A printer’s point |
For example, this code will make the title “Red, White, and Blue” appear in different colors.
title color=red "Red," color=white "White, and" color=blue "Blue";
If you use single quotation marks ('') or double quotation marks (””) together (with no space in between them) as the string of text, SAS will output a single quotation mark ( ') or double quotation marks (””), respectively.
If you use an automatic macro variable in the title text, you must enclose the title text in double quotation marks. The SAS macro facility will resolve the macro variable only if the text is in double quotation marks.
/********************************************* *The following program creates the data set * *grain_production and the $cntry format. * *********************************************/ data grain_production; length Country $ 3 Type $ 5; input Year country $ type $ Kilotons; datalines; 1995 BRZ Wheat 1516 1995 BRZ Rice 11236 1995 BRZ Corn 36276 1995 CHN Wheat 102207 1995 CHN Rice 185226 1995 CHN Corn 112331 1995 IND Wheat 63007 1995 IND Rice 122372 1995 IND Corn 9800 1995 INS Wheat . 1995 INS Rice 49860 1995 INS Corn 8223 1995 USA Wheat 59494 1995 USA Rice 7888 1995 USA Corn 187300 2010 BRZ Wheat 3302 2010 BRZ Rice 10035 2010 BRZ Corn 31975 2010 CHN Wheat 109000 2010 CHN Rice 190100 2010 CHN Corn 119350 2010 IND Wheat 62620 2010 IND Rice 120012 2010 IND Corn 8660 2010 INS Wheat . 2010 INS Rice 51165 2010 INS Corn 8925 2010 USA Wheat 62099 2010 USA Rice 7771 2010 USA Corn 236064 ; run; proc format; value $cntry 'BRZ'='Brazil' 'CHN'='China' 'IND'='India' 'INS'='Indonesia' 'USA'='United States'; run;
/***************************************** *This PROC TEMPLATE step creates the * *table definition TABLE1 that is used * *in the DATA step. * *****************************************/ proc template; define table table1; mvar sysdate9; dynamic colhd; classlevels=on; define column char_var; generic=on; blank_dups=on; header=colhd; style=cellcontents; end; define column num_var; generic=on; header=colhd; style=cellcontents; end; define footer table_footer; end; end; run;
/*********************************************************************** *The ODS HTML statement creates HTML output created with * *the style defintion D3D. * * * *The TITLE statement specifies the text for the first title * *and the attributes that ODS uses to modify it. * *The J= style attribute left-justifies the title. * *The COLOR= style attributes change the color of the title text * *"Leading Grain" to blue and "Producers in" to green. * * * *The TITLE2 statement specifies the text for the second title * *and the attributes that ODS uses to modify it. * *The J= style attribute center justifies the title. * *The COLOR= attribute changes the color of the title text "2010" * *to red. * * The HEIGHT= attributes change the size of each * *individual number in "2010". * * * *The FOOTNOTE statement specifies the text for the first footnote * *and the attributes that ODS uses to modify it. * *The J=left style attribute left-justifies the footnote. * *The HEIGHT=20 style attribute changes the font size to 20pt. * *The COLOR= style attributes change the color of the footnote text * *"Prepared" to red and "on" to green. * * * *The FOOTNOTE2 statement specifies the text for the second footnote * *and the attributes that ODS uses to modify it. * *The J= style attribute centers the footnote. * *The COLOR= attribute changes the color of the date * *to blue, * *The HEIGHT= attribute changes the font size * *of the date specified by the sysdate9 macro. * ***********************************************************************/ ods html body='newstyle-body.htm' style=d3d; title j=left font= 'Times New Roman' color=blue bcolor=red "Leading Grain " c=green bold italic "Producers in"; title2 j=center color=red underlin=1 height=28pt "2" height=24pt "0" height=20pt "1" height=16pt "0"; footnote j=left height=20pt color=red "Prepared " c='#FF9900' "on"; footnote2 j=center color=blue height=24pt "&sysdate9"; footnote3 link='http://support.sas.com' "SAS"; /*********************************************************** *This step uses the DATA step and ODS to produce * *an HTML report. It uses the default table definition * *(template) for the DATA step and writes an output object * *to the HTML destination. * ***********************************************************/ data _null_; set grain_production; where type in ('Rice', 'Corn') and year=1996; file print ods=( template='table1' columns=( char_var=country(generic=on format=$cntry. dynamic=(colhd='Country')) char_var=type(generic dynamic=(colhd='Year')) num_var=kilotons(generic=on format=comma12. dynamic=(colhd='Kilotons')) ) ); put _ods_; run;