BookmarkSubscribeRSS Feed
Daily1
Quartz | Level 8

 

ods markup file="Report.xls" tagset=tagsets.test    ;
	title1 j = c bold 'A1';
	title2 j = c "A2";
	title3 j = l " A3" j = r " A4";

proc print data=Sashelp.Class;
run;
title1;
title2;
title3;
ods _all_ close;
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; 

Result.xls

Daily1_0-1709112972725.png

 

 

I want 

Daily1_0-1709112645372.png

Please do not mention using ODS Excel. I am already aware that the correct way to display the answer is by using ODS Excel.

 

4 REPLIES 4
ballardw
Super User

If your undesired A3 and A4 appear in a single cell, which there is no way we can tell from that picture, I would guess the vertical offset is the result of the displayed line being wrapped to fit the cell width. Which may require some control on the length of text but no clue how to do that in such an approach.

Cynthia_sas
SAS Super FREQ
Hi, The OTHER alternative is to use ODS TAGSETS.EXCELXP to create a Microsoft XML file that Excel can open or to use ODS CSVALL to make a CSV file with titles. However, you don't have as much control over the titles and alignment with ODS CSVALL.
Cynthia
Daily1
Quartz | Level 8

I'm using ODS markup with the tagset for the font_face='DVOT-SurekhMR'. Only ODS markup reflects the font_face='DVOT-SurekhMR'; other ODS Excel formats do not work with this font. That's why I'm using ODS markup. If you have any suggestions for why this font is not working with other ODS formats, please let me know.

Cynthia_sas
SAS Super FREQ

Hi:
That doesn't make sense. If ODS uses the font with ODS Markup, then as long as the font is registered on your system, other ODS destinations should also be able to use it.
This is sounding like a question for Tech Support so they can open a case and look at your registry settings.

  Also, I don't see any reference to your font in the code that you posted. When you work with Tech Support, you'll have to send them ALL your code and a sample of your data.
Cynthia

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 4 replies
  • 676 views
  • 0 likes
  • 3 in conversation