BookmarkSubscribeRSS Feed
KarenES
Calcite | Level 5

                                        Hello everyone,

Happy Halloween.

I have a problem that is plaguing my work. My MS Word documents that contain tables and text created through SAS ODS RTF output.

I have tried with and without TOC (TOC inserts XML that creates automagic table of contents). It randomly stops working and shuts down Word when I am making edits. None of the tables displayed are linked to external excel spread sheets or anything like this. My IT group has worked hard on this issue and optimized everything possible.

I have SAS 9.3 for 64 bit, loads of memory, Windows 7 operating system, and Office 2010.

I appreciate any help that you may provide. We have worked on all the possible windows and microsoft possible issues. Now we are working on the possibility there is something between SAS ODS RTF and microsoft that is not behaving for me.

Thank you,

Karen

PS. I have also posted this on the SAS UK user group. My appologies to any who recieve this question twice.

HERE IS THE SAS CODE TO CREATE THE ODS RTF:

ODS Escapechar = '~';
options     nonumber /*supresses automatic page number at top of output*/
            orientation=portrait     /*sets the page orientation to either landscape or portrait - starting 9.2 we may change orientation within a document*/
            topmargin = '.5in' bottommargin = '.5in' leftmargin = '.5in' rightmargin = '.5in' /*this does not work too well in 9.1.3*/
            FORMCHAR="|----|+|---+=|-/\<>*"; /*according to several sources and SAS, this helps to make print align better*/

               
ODS Escapechar = '~';
options     nonumber /*supresses automatic page number at top of output*/
            orientation=portrait     /*sets the page orientation to either landscape or portrait - starting 9.2 we may change orientation within a document*/
            topmargin = '.5in' bottommargin = '.5in' leftmargin = '.5in' rightmargin = '.5in' /*this does not work too well in 9.1.3*/
            FORMCHAR="|----|+|---+=|-/\<>*"; /*according to several sources and SAS, this helps to make print align better*/


            /*this is an example of outputing to an RTF file which is quite easly rendered by MS Word*/
ODS RTF        FILE= 'S:\Science and Research\Survey Research\test.rtf' /*designates where and what type of file*/
            Style=journal /*selects style from SASUSER library;
                            if it does not exist in SASUSER it
                            will automatically get the style from SASHELP*/
            startpage = yes /*no header or page number on first page*/
            sasdate  /*this sets the data at the header to be static*/
            contents=yes /*sets an automatic table of contents*/;
            footnote 'Page ~{thispage} of ~{lastpage}';
            ODS NOPROCTITLE; /*Suppress proc titles added to each proc - rather anoying in the print out*/
            ods proclabel 'Chi Square by demograpaphics';

PROC freq data=ds ; /*proc freq and proc survey freq are very similar.
                         If the cummulative N and % are suppressed in PROC FREQ, totals are not displayed*/
          label &labelit ; /*this statement puts variable labels in the output. */
         format &formatit q4 aquiregrpa. q46 typeb. ; /* this statement puts labels on the values and missing designations within specified variables*/
        /*         note: these are usually macro variables in a script called values and formats that is run after the setup file
                Consistence in labeling is very helpful with MACROS so that script is easily used across projects*/
        /*order is important for FORMAT- the last format is the one used by the proc*/

        ODS noproctitle;
tables    (    q36     )*(q4)/  missing   nocum norow;                        tables    (    q36)*(q4)/chisq        NOFREQ    NOPRINT;   
tables    (    q36     )*(q5)/  missing   nocum norow;                        tables    (    q36)*(q5)/chisq        NOFREQ    NOPRINT;   
            /*this suppresses the cumulative percentage but note how it also does not report totals*/
run; title; /*typical run statement and the title without a title clears all titles*/


ods _all_ close;
ODS listing;

2 REPLIES 2
DanH_sas
SAS Super FREQ

Hey Karen,

You may want to move this post over to "ODS and Base Reporting". The group deals with graphics output from SAS/GRAPH and ODS.

Thanks!
Dan

Cynthia_sas
SAS Super FREQ

Hi:

   Actually, the ODS RTF CONTENTS= option inserts RTF control strings that correspond to the Word field codes for creating a TOC -- any word processor that knows how to render RTF control strings, should be able to create a table of contents, as long as the word processor supports the contents option.

  The RTF specification was written by MIcrosoft, so the behavior you observe is puzzling.

  ODS TAGSETS.EXCELXP is the ODS destination that creates Microsoft Spreadsheet Markup Language 2003 XML So, if you use CONTENTS= with TAGSETS.EXCELXP, you get XML generated. But, if you use CONTENTS= with ODS RTF, you get RTF control strings that roughly correspond to MIcrosoft Word field codes.

  This actually sounds like an issueto report to Tech Support. If there is a bug that needs to be fixed, Tech Support can report it to the RTF developers.

cynthia

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1011 views
  • 0 likes
  • 3 in conversation