BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BruceBrad
Lapis Lazuli | Level 10

I'm finding that some of my RTF files are being reported by Word as having corrupt tables. There is no error message in the log file of the SAS program that created them. I'm not using any special formatting commands other than {NEWLINE} statements in tables. The tables are quite large however. Any solution to this? 

1 ACCEPTED SOLUTION

Accepted Solutions
BruceBrad
Lapis Lazuli | Level 10

Removing "/row = float" and replacing with "/nocellmerge" fixed the problem. (I didn't really need the row titles to float, but did want the cells in the xlsx output to be not merged). Incidentally, row=float was not a problem for my smaller tables - it just seemed to produce problems for large tables.

View solution in original post

6 REPLIES 6
Kurt_Bremser
Super User

Open the files with an alternative, like LibreOffice. If that also chokes on the files, open a track with SAS technical support, as you might have uncovered a problem in ODS RTF.

ballardw
Super User

Did you try it without the {newline}?

 

It might help to show at least the code used. And since this is an ODS issue include the ODS RTF along with whatever table generating code you use.

 

Word does enough all by itself on "corrupting" large complex tables. So you also might consider whether a set of simpler tables would do.

BruceBrad
Lapis Lazuli | Level 10

Thanks for the LibreOffice tip. It does open in LO, but the table is nonetheless messed up. See below.The years should be in the second column (which they are for the other family types not shown). However, it does look like I was on the wrong track thinking about the RTF output. My program also writes xlsx and html, and it is messed up there too. So is this a proc tabulate problem? An excerpt of my code is:

 

 

options ls=max ps=max;
options papersize=A4 orientation=portrait;
ods _all_ close;
ods graphics on /reset=index height=11.5in ;
ods rtf  style=bbfp file="&Output\Trends.rtf"  image_dpi=300 bodytitle;
ods html style=bbfp path="&SASImages" gpath="&SASImages"  image_dpi=300;
ods Excel file="&Output\Trends.xlsx" style=BBfp options(sheet_interval='NONE' embedded_titles='yes')  ;
ods escapechar="~";  /* used to insert special formatting commands, like {NEWLINE} */

[cut] proc tabulate data=dat1 style=[cellwidth=75]; weight w1; class surveyyear hhstruct21 H_IS; label surveyyear=; label hhstruct21='00'x; label H_IS='00'x; var Y one; table hhstruct21*surveyyear='' , (H_IS all="All people")* (p10 p20 median mean)*f=comma6.0* y="" / row=float ; run;

 

 

 

 

 

BruceBrad_0-1590494123884.png

 

BruceBrad
Lapis Lazuli | Level 10

Removing "/row = float" and replacing with "/nocellmerge" fixed the problem. (I didn't really need the row titles to float, but did want the cells in the xlsx output to be not merged). Incidentally, row=float was not a problem for my smaller tables - it just seemed to produce problems for large tables.

ballardw
Super User

@BruceBrad wrote:

Removing "/row = float" and replacing with "/nocellmerge" fixed the problem. (I didn't really need the row titles to float, but did want the cells in the xlsx output to be not merged). Incidentally, row=float was not a problem for my smaller tables - it just seemed to produce problems for large tables.


You might also look at why you tried to set

style=[cellwidth=75];

Especially without specifying a unit for the width. 

I have had the problem with tables displaying the way you show, some columns on some rows not aligning correctly but for me the fix was row=float.

 

The "labels" of '00'x might partially be an issue as well but without data to test anything I can't say for sure. Why are you using those labels?

BruceBrad
Lapis Lazuli | Level 10

Yes, I should specify units on the cellwidth. (The doc suggests the default is 1/150 inch).

 

The '00'x labels are to remove the labels for these variables. This does seem odd, but I haven't found a better way to do it.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 6 replies
  • 3008 views
  • 1 like
  • 3 in conversation