Looking to format the bodydate text below.
Ran the below and looks like I can not use a standard SAS Format in the class bodydate?
Where can I format it something like mm/dd/yyyy
(The below give me : 9:30 Tuesday, January 31, 2012)
Proc Template;
define style styles.pageno;
parent = styles.normal;
class bodydate / vjust=bottom just=left fontsize=10pt format mmddyy8. pretext="Report Date:";
class Pageno / vjust=bottom just=left fontsize=10pt petext="Page Number:";
.......
TIA, Jay
Hi:
If you look in the doc, at the list of style attributes
you will see that FORMAT is not a style attribute. What you are defining in your CLASS statement are the style attributes (like vjust= just= fontsize=) that belong to style elements (like bodydate and pageno).
You should be seeing this error message in your SAS log:
487 format mmddyy8.
------
22
202
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, ;, ABSTRACT,
ACTIVELINKCOLOR, ASIS, ATTRPRIORITY, BACKGROUNDCOLOR, BACKGROUNDIMAGE,
BACKGROUNDPOSITION, BACKGROUNDREPEAT, BODYSCROLLBAR, BODYSIZE, BORDERBOTTOMCOLOR,
BORDERBOTTOMSTYLE, BORDERBOTTOMWIDTH, BORDERCOLLAPSE, BORDERCOLOR, BORDERCOLORDARK,
BORDERCOLORLIGHT, BORDERLEFTCOLOR, BORDERLEFTSTYLE, BORDERLEFTWIDTH,
BORDERRIGHTCOLOR, BORDERRIGHTSTYLE, BORDERRIGHTWIDTH, BORDERSPACING, BORDERSTYLE,
BORDERTOPCOLOR, BORDERTOPSTYLE, BORDERTOPWIDTH, BORDERWIDTH, CAPSTYLE, CELLPADDING,
CELLSPACING, CLASS, COLOR, CONNECT, CONTENTPOSITION, CONTENTSCROLLBAR, CONTENTSIZE,
CONTENTTYPE, CONTRASTCOLOR, CSSSTYLE, CSSTEXT, CURSOR, DATASKIN, DESCRIPTION,
DISPLAYOPTS, DOCTYPE, DROPSHADOW, ENDCOLOR, FILLPATTERN, FILLRULEWIDTH, FLYOVER,
FONT, FONTFAMILY, FONTSIZE, FONTSTYLE, FONTWEIGHT, FONTWIDTH, FRAME, FRAMEBORDER,
FRAMEBORDERWIDTH, FRAMESPACING, GRADIENTDIRECTION, HEIGHT, HREFTARGET, HTMLID,
HTMLSTYLE, IMAGESTYLE, JUST, KPISKIN, LINESTYLE, LINETHICKNESS, LINKCOLOR,
LISTENTRYANCHOR, LISTENTRYDBLSPACE, LISTSTYLEIMAGE, LISTSTYLEMARKER, LISTSTYLETYPE,
MARGIN, MARGINBOTTOM, MARGINLEFT, MARGINRIGHT, MARGINTOP, MARKERSIZE, MARKERSYMBOL,
MINOR, NEUTRALCOLOR, NOBREAKSPACE, OFFSET, OVERHANGFACTOR, PADDING, PADDINGBOTTOM,
PADDINGLEFT, PADDINGRIGHT, PADDINGTOP, PAGEBREAKHTML, POSTHTML, POSTIMAGE, POSTTEXT,
PREHTML, PREIMAGE, PRETEXT, PROTECTSPECIALCHARS, RULES, STARTCOLOR, TAGATTR,
TEXTALIGN, TEXTDECORATION, TEXTINDENT, TEXTJUSTIFY, THRESHOLD, TICKDISPLAY,
TRANSPARENCY, URL, VERTICALALIGN, VISITEDLINKCOLOR, VJUST, WATERMARK, WHITESPACE,
WIDTH.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
488 pretext="Report Date:";
Which also means your template will not be saved and you should also be seeing this warning (or one like it in your log -- if you were using ODS PDF, for example):
WARNING: Style STYLES.PAGENO not found; Printer style will be used instead.
Usually, for paged destinations, I use TITLE and FOOTNOTE statements to accomplish special placement for the page number and/or date. That means I turn off the SAS options for date and numbering. And I usually want my page numbers to be at the bottom of the page, too.
For example, if you look at this paper (see pages 14-15) http://support.sas.com/resources/papers/proceedings11/300-2011.pdf for information about inserting a page number. You can also use similar techniques to impact the date.
The program below shows how to use the TITLE and FOOTNOTE statements for the page numbers and dates (without a changed style template). If you want to use the style template method of controlling information, then this Tech Support note worked for me, http://support.sas.com/kb/24/183.html (but not to format the date differently).
cynthia
options nodate nonumber;
ods escapechar='^';
ods pdf file='c:\temp\pageno.pdf' style=normal;
title j=r f='Helvetica' h=10pt bold
"Report Date: %SYSFUNC(TODAY(),Worddate.)";
footnote h=10pt f='Helvetica' bold
j=c 'Page No: ^{thispage}'
j=r "Date: %sysfunc(today(),mmddyy10.)";
proc print data=sashelp.class;
run;
ods pdf close;
Hi:
If you look in the doc, at the list of style attributes
you will see that FORMAT is not a style attribute. What you are defining in your CLASS statement are the style attributes (like vjust= just= fontsize=) that belong to style elements (like bodydate and pageno).
You should be seeing this error message in your SAS log:
487 format mmddyy8.
------
22
202
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, ;, ABSTRACT,
ACTIVELINKCOLOR, ASIS, ATTRPRIORITY, BACKGROUNDCOLOR, BACKGROUNDIMAGE,
BACKGROUNDPOSITION, BACKGROUNDREPEAT, BODYSCROLLBAR, BODYSIZE, BORDERBOTTOMCOLOR,
BORDERBOTTOMSTYLE, BORDERBOTTOMWIDTH, BORDERCOLLAPSE, BORDERCOLOR, BORDERCOLORDARK,
BORDERCOLORLIGHT, BORDERLEFTCOLOR, BORDERLEFTSTYLE, BORDERLEFTWIDTH,
BORDERRIGHTCOLOR, BORDERRIGHTSTYLE, BORDERRIGHTWIDTH, BORDERSPACING, BORDERSTYLE,
BORDERTOPCOLOR, BORDERTOPSTYLE, BORDERTOPWIDTH, BORDERWIDTH, CAPSTYLE, CELLPADDING,
CELLSPACING, CLASS, COLOR, CONNECT, CONTENTPOSITION, CONTENTSCROLLBAR, CONTENTSIZE,
CONTENTTYPE, CONTRASTCOLOR, CSSSTYLE, CSSTEXT, CURSOR, DATASKIN, DESCRIPTION,
DISPLAYOPTS, DOCTYPE, DROPSHADOW, ENDCOLOR, FILLPATTERN, FILLRULEWIDTH, FLYOVER,
FONT, FONTFAMILY, FONTSIZE, FONTSTYLE, FONTWEIGHT, FONTWIDTH, FRAME, FRAMEBORDER,
FRAMEBORDERWIDTH, FRAMESPACING, GRADIENTDIRECTION, HEIGHT, HREFTARGET, HTMLID,
HTMLSTYLE, IMAGESTYLE, JUST, KPISKIN, LINESTYLE, LINETHICKNESS, LINKCOLOR,
LISTENTRYANCHOR, LISTENTRYDBLSPACE, LISTSTYLEIMAGE, LISTSTYLEMARKER, LISTSTYLETYPE,
MARGIN, MARGINBOTTOM, MARGINLEFT, MARGINRIGHT, MARGINTOP, MARKERSIZE, MARKERSYMBOL,
MINOR, NEUTRALCOLOR, NOBREAKSPACE, OFFSET, OVERHANGFACTOR, PADDING, PADDINGBOTTOM,
PADDINGLEFT, PADDINGRIGHT, PADDINGTOP, PAGEBREAKHTML, POSTHTML, POSTIMAGE, POSTTEXT,
PREHTML, PREIMAGE, PRETEXT, PROTECTSPECIALCHARS, RULES, STARTCOLOR, TAGATTR,
TEXTALIGN, TEXTDECORATION, TEXTINDENT, TEXTJUSTIFY, THRESHOLD, TICKDISPLAY,
TRANSPARENCY, URL, VERTICALALIGN, VISITEDLINKCOLOR, VJUST, WATERMARK, WHITESPACE,
WIDTH.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
488 pretext="Report Date:";
Which also means your template will not be saved and you should also be seeing this warning (or one like it in your log -- if you were using ODS PDF, for example):
WARNING: Style STYLES.PAGENO not found; Printer style will be used instead.
Usually, for paged destinations, I use TITLE and FOOTNOTE statements to accomplish special placement for the page number and/or date. That means I turn off the SAS options for date and numbering. And I usually want my page numbers to be at the bottom of the page, too.
For example, if you look at this paper (see pages 14-15) http://support.sas.com/resources/papers/proceedings11/300-2011.pdf for information about inserting a page number. You can also use similar techniques to impact the date.
The program below shows how to use the TITLE and FOOTNOTE statements for the page numbers and dates (without a changed style template). If you want to use the style template method of controlling information, then this Tech Support note worked for me, http://support.sas.com/kb/24/183.html (but not to format the date differently).
cynthia
options nodate nonumber;
ods escapechar='^';
ods pdf file='c:\temp\pageno.pdf' style=normal;
title j=r f='Helvetica' h=10pt bold
"Report Date: %SYSFUNC(TODAY(),Worddate.)";
footnote h=10pt f='Helvetica' bold
j=c 'Page No: ^{thispage}'
j=r "Date: %sysfunc(today(),mmddyy10.)";
proc print data=sashelp.class;
run;
ods pdf close;
Thank you Cynthia, worked like a charm.
I used the footnote text from above...
Thanks again, and GO Patriots!
J
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.