I have four goals to learn about ODS TAGSETS.RTF and or PROC TEMPLATE. Could you, kindly, help me learn to do some of these goals using this mock document.
ods tagsets.rtf
style= daisy
options (
VSPACE='OFF'
)
;
option nocenter;
title;
/*Because Proc Template is hard:*/
%let normal=font_size=11pt;
%let answer=[fontweight=bold liststyletype="none"];
%let table_answer=[fontweight=bold &normal];
%let systemtitle=[fontweight=bold font_size=12pt];
%let sub_title=[fontweight=bold &normal];
%let mid_title=[fontweight=bold font_size=14pt just=c];
%let normal=[font_size=11pt];
%let Small_line=[font_size=5pt];
proc odstext;
p "Neque Porro Quisquam est qui Dolorem Ipsum " /style=&systemtitle;
p " "/style=&Small_line;
p "Quia Dolor sit Amet, Consectetur, Adipisci Velit"/style=&sub_title;
p " "/style=&Small_line;
p "Objectives:"/style=&sub_title;
p;
p '10A. Mauris iaculis libero a purus eleifend viverra.'/style=&normal;
p;
run;
%let question_10A_make=0;
proc sql noprint ;
select distinct Make, count(*)
into :null, :question_10A_make
from sashelp.CARS
where Make='Acura'
;
run;
proc odstext;
list;
item "%CMPRES(&question_10A_make)"/style=&answer ;
end;
p;
p "Donec Sagittis Neque Quis Starting 12-2017" /style=&mid_title ;
p;
p '15B. Lorem ipsum dolor sit amet, consectetur adipiscing elit.'/style=&normal;
p;
run;
PROC FREQ DATA=sashelp.cars (obs=50);
TABLES Make / NOPRINT out=make ;
proc odstable data=make PAGEBREAK=NO;
column blank Make count;
define Make ;
format=$ENRLST.;
PRINT_HEADERS=OFF;
end;
define count;
style=&table_answer;
format=3.0;
PRINT_HEADERS=OFF;
end;
define column blank;
style={cellwidth=0.6in};
PRINT_HEADERS=OFF;
compute as " ";
end;
run;
proc odstext;
p;p;
p "To Do:" /style=&systemtitle;
p;
list;
item 'Change all page margins to 1"';
item "Revove date, time and page number from the top of the page.";
item "Remove grey border from table, or set color to white.";
item "Implment a half line space between title lines.";
end;
run;
ods tagsets.rtf close;
I found all my answers in this document. It was very helpful.
"SAS with Style: Creating your own ODS Style Template for RTF Output" Lauren Haworth, May 2004, Sugi 29.
Working with templates is usually never easy, but it ended out being very easy. I couldn't believe it
Correction: I have updated this so that it conforms with the standard that does not use the deprecated "replace" and instead used "class".
ods path reset;
ods path(REMOVE) SASUSER.templat;
ods path(PREPEND) Work.templat(update);
proc template;
define style Styles.Custom;
parent = Styles.RTF;
class fonts /
'docFont' = ("Arial",11pt) /* Data in table cells */
;
class Table from Output /
frame = VOID /* outside borders: void, box, above/below, vsides/hsides, lhs/rhs */
rules = NONE /* internal borders: none, all, cols, rows, groups */
cellpadding = 2pt /* the space between table cell contents and the cell border */
cellspacing = 0pt /* the space between table cells, allows background to show */
borderwidth = 0pt /* the width of the borders and rules */
;
class Body from Document /
bottommargin = 1in
topmargin = 1in
rightmargin = 1in
leftmargin = 1in
;
end;
run;
option nocenter nodate nonumber ;
title;
%let normal=font_size=11pt;
%let answer=[fontweight=bold Leftmargin=0.6in ];
%let table_answer=[fontweight=bold &normal];
%let systemtitle=[fontweight=bold font_size=12pt];
%let sub_title=[fontweight=bold &normal];
%let mid_title=[fontweight=bold font_size=14pt just=c];
%let normal=[font_size=11pt];
%let Small_line=[font_size=5pt];
ods tagsets.rtf
style= Styles.Custom /*Changed*/
options (
VSPACE='OFF'
)
;
proc odstext;
p "Neque Porro Quisquam est qui Dolorem Ipsum " /style=&systemtitle;
p " "/style=&Small_line;
p "Quia Dolor sit Amet, Consectetur, Adipisci Velit"/style=&sub_title;
p " "/style=&Small_line;
p "Objectives:"/style=&sub_title;
p;
p '10A. Mauris iaculis libero a purus eleifend viverra.'/style=&normal;
p;
run;
/* ... */
s
Easy one first:
Remove date, time and page number from the top of the page. OPTIONS nonumber nodate ; will turn off those features for all output until you ask for them.
Likely easy:
Remove grey border from table, or set color to white.
One way is to use a style that doesn't have outlines
Another is STYLEOVERIDE in a procedure, depending on procedures.
You will have to describe what : Implement a half line space between title lines. means in a bit more details.
I can think of different things that fit that text. One is to actually draw some sort of line. Or do you mean to set vertical space as 1.5 lines?
Also, changing the margins should be as simple as adding the margin controls to the OPTIONS statement:
options nodate nonumber topmargin=1in bottommargin=1in leftmargin=1in rightmargin=1in;
Cynthia
I'm finding the places in the documentation that I didn't consider when researching. Thanks.
1. Nonumber nodate. Thanks
2a. Using another style means finding another style but I've looked at a gallery (SAS ODS Styles Gallery) all tables have some kind of border.
2b. I'll look into this style overrides more.
3. Yes you're right, "be more specific", lol, I did mean vertical spacing. My theory failed in my attempt to make a 0.5 spaced line using font_size. There's definitely a size limit independent of how small a font_size is provided.
I found all my answers in this document. It was very helpful.
"SAS with Style: Creating your own ODS Style Template for RTF Output" Lauren Haworth, May 2004, Sugi 29.
Working with templates is usually never easy, but it ended out being very easy. I couldn't believe it
Correction: I have updated this so that it conforms with the standard that does not use the deprecated "replace" and instead used "class".
ods path reset;
ods path(REMOVE) SASUSER.templat;
ods path(PREPEND) Work.templat(update);
proc template;
define style Styles.Custom;
parent = Styles.RTF;
class fonts /
'docFont' = ("Arial",11pt) /* Data in table cells */
;
class Table from Output /
frame = VOID /* outside borders: void, box, above/below, vsides/hsides, lhs/rhs */
rules = NONE /* internal borders: none, all, cols, rows, groups */
cellpadding = 2pt /* the space between table cell contents and the cell border */
cellspacing = 0pt /* the space between table cells, allows background to show */
borderwidth = 0pt /* the width of the borders and rules */
;
class Body from Document /
bottommargin = 1in
topmargin = 1in
rightmargin = 1in
leftmargin = 1in
;
end;
run;
option nocenter nodate nonumber ;
title;
%let normal=font_size=11pt;
%let answer=[fontweight=bold Leftmargin=0.6in ];
%let table_answer=[fontweight=bold &normal];
%let systemtitle=[fontweight=bold font_size=12pt];
%let sub_title=[fontweight=bold &normal];
%let mid_title=[fontweight=bold font_size=14pt just=c];
%let normal=[font_size=11pt];
%let Small_line=[font_size=5pt];
ods tagsets.rtf
style= Styles.Custom /*Changed*/
options (
VSPACE='OFF'
)
;
proc odstext;
p "Neque Porro Quisquam est qui Dolorem Ipsum " /style=&systemtitle;
p " "/style=&Small_line;
p "Quia Dolor sit Amet, Consectetur, Adipisci Velit"/style=&sub_title;
p " "/style=&Small_line;
p "Objectives:"/style=&sub_title;
p;
p '10A. Mauris iaculis libero a purus eleifend viverra.'/style=&normal;
p;
run;
/* ... */
s
Dive into keynotes, announcements and breakthroughs on demand.
Explore Now →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.