The SAS Output Delivery System and reporting techniques

PC MS Word problems... Related to SAS ODS RTF output?

Reply
Occasional Contributor
Posts: 14

PC MS Word problems... Related to SAS ODS RTF output?

                                        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;

SAS Super FREQ
Posts: 939

PC MS Word problems... Related to SAS ODS RTF output?

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

SAS Super FREQ
Posts: 8,868

PC MS Word problems... Related to SAS ODS RTF output?

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

Ask a Question
Discussion stats
  • 2 replies
  • 307 views
  • 0 likes
  • 3 in conversation