DATA Step, Macro, Functions and more

Getting various report formats to look alike from Proc Tabulate

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

Getting various report formats to look alike from Proc Tabulate

The Proc Tabulate code below generates good looking HTML files but when I change the ODS format to RTF or PDF they look like hell.   The biggest problem is that the rows containing the data are all squished so the numbers aren't readable.   I don't really want to have a different version of Proc Tabulate for each ODS output type but if that's the only solution I'll do it. 

 

Also if I change the html file extension to .xls  it will open in Excel and look pretty good but Excel gives a warning message that the file is corrupt.

 

Any suggestions for either of those issues?   If I need to post sample outputs I'll be happy to.

 

 

--------------------   code -------------------

proc tabulate data =&input f=4.0 S=[just=c cellwidth=25]; 
var Col1;
class criterion instrument /ORDER=DATA ;
class _name_ ;
table instrument*criterion all={label='Total' s=[just=R background=goldenrod]}*{s=[background=goldenrod]} ,(_name_='Level' ALL)*Col1=" "*(sum="N"*(f=3.0) ROWPCTSUM="%"*f=mypct. ) /box=&reportdate; 
BY instrument NOTSORTED; 
run;

 


Accepted Solutions
Solution
‎02-28-2016 07:03 PM
Super User
Posts: 9,681

Re: Getting various report formats to look alike from Proc Tabulate

1) You can't expect  they have the look in different ODS.

2) if You change the html file extension to .xml ,might get rid of that annonying warning message. I didn't test it ,just guess .

View solution in original post


All Replies
Super User
Posts: 6,941

Re: Getting various report formats to look alike from Proc Tabulate

Excel expects its old native format when a file has the extension .xls. The same is true for the otzher extensions and file formats.

HTML is HTML, RTF is RTF, XML is XML, XLS is XLS , and XLSX is XLSX. Don't obfuscate your data by using improper file extensions.

 

Your problem might be the graphics format that needs to be used in RTF or PDF. HTML allows embedding of ActiveX graphics, which look prettiest of all.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 15

Re: Getting various report formats to look alike from Proc Tabulate

When I tried using ods excel options the results always looks terrible.   I read an article that suggested simply using ods html with an .xls extension.   That looks a lot better but it's still not perfect.  I should have said that this is using SAS 9.2.   I now see there are other ways of generating excel readable outputs.  I'll experiment with other options.  My report is very basic, no graphics or fancy stuff, just text and numbers and colors.

Solution
‎02-28-2016 07:03 PM
Super User
Posts: 9,681

Re: Getting various report formats to look alike from Proc Tabulate

1) You can't expect  they have the look in different ODS.

2) if You change the html file extension to .xml ,might get rid of that annonying warning message. I didn't test it ,just guess .

Occasional Contributor
Posts: 15

Re: Getting various report formats to look alike from Proc Tabulate

changing the extension to .xml didn't help. Changing to ods excel didn't work because I'm using version 9.2 and I don't think it existed then. The best I've been able to do is use ods html with an .xls extension. It opens in Excel reluctantly, but it does!
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 228 views
  • 1 like
  • 3 in conversation