BookmarkSubscribeRSS Feed
Daily1
Quartz | Level 8

proc template;
define tagset tagsets.test;
parent=tagsets.phtml;
define event doc;
start:
put HTMLDOCTYPE NL NL NL;
put '<html xmlns:o="urn:schemas-microsoft-com:office:office"' NL;
put 'xmlns:x="urn:schemas-microsoft-com:office:excel"' NL;
put 'xmlns="http://www.w3.org/TR/REC-html40">' NL;

finish:
put "</html>" NL;
end;

define event doc_head;
start:
put "<head>" NL;
put VALUE NL;
put "<style>" NL "<!--" NL;
trigger alignstyle;
put "-->" NL "</style>" NL;
finish:

put " <!--[if gte mso 9]><xml>" NL;
put " <x:ExcelWorkbook>" NL;
put " <x:ExcelWorksheets>" NL;
put " <x:ExcelWorksheet>" NL;
put " <x:Name>Sheet1</x:Name>" NL;
put " <x:WorksheetOptions>" NL;
put " <x:Zoom>100</x:Zoom>" NL;
put " <x:Selected/>" NL;
put " <x:Panes>" NL;
put " <x:Pane>" NL;
put " <x:Number>3</x:Number>" NL;
put " <x:ActiveCol>1</x:ActiveCol>" NL;
put " </x:Pane>" NL;
put " </x:Panes>" NL;
put " <x:ProtectContents>False</x:ProtectContents>" NL;
put " <x:ProtectObjects>False</x:ProtectObjects>" NL;
put " <x:ProtectScenarios>False</x:ProtectScenarios>" NL;
put " </x:WorksheetOptions>" NL;
put " </x:ExcelWorksheet> " NL;
put " <x:WindowHeight>8070</x:WindowHeight> " NL;
put " <x:WindowWidth>10380</x:WindowWidth> " NL;
put " <x:WindowTopX>480</x:WindowTopX> " NL;
put " <x:WindowTopY>120</x:WindowTopY> " NL;
put " <x:ProtectStructure>False</x:ProtectStructure> " NL;
put " <x:ProtectWindows>False</x:ProtectWindows>" NL;
put " </x:ExcelWorkbook>" NL;
put " </xml><![endif]--> " NL;
put "</head>" NL;
end;
end;
run;
proc template;
define style styles.mystyle;
parent = Styles.Default;
style body /
background = white
foreground = black
;
style systemtitle /
font_face = 'Times New Roman'
font_weight = bold
font_size = 12pt
;
style systemfooter /
font_face = 'Times New Roman'
font_size = 8pt
;
style data /
fontfamily = 'Times New Roman'
font_size = 10pt
foreground = black
;
style header /
fontfamily = 'Times New Roman'
font_size = 10pt
foreground = Black
/* font_weight = bold */
/* background = #A9D0F5 */
background = white
;

style summary /
fontfamily = 'Times New Roman'
font_size = 10pt
foreground = Black
font_weight = bold
/* background = #A9D0F5 */
background = white
;

style table /
cellpadding = 5px
cellspacing = 0px
borderwidth = 1px
bordercolor = black
borderstyle = solid
;
end;
run;

ods markup file="sas.rtf" tagset=tagsets.test alias='normal' style=mystyle;
title1 "Data Set";
proc report data=sashelp.cars(obs=5);
col Make Model Type Origin DriveTrain;

run;
title1;

title2 "Data Set1";

proc report data=sashelp.class (obs=5);
run;
title2;
ods rtf close;

 

 

 

I want to two report seperate page start

Daily1_0-1681884252054.png

 

 

1 REPLY 1
Kurt_Bremser
Super User

This is a follow-up to https://communities.sas.com/t5/ODS-and-Base-Reporting/ods-markup-to-rtf/m-p/870123 

 

So you disguise HTML as RTF, but it is in fact targeted at Excel?

Use ODS EXCEL.

And if you need to accommodate multiple targets, open multiple destinations concurrently.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 596 views
  • 0 likes
  • 2 in conversation