BookmarkSubscribeRSS Feed
AntuMaria
Calcite | Level 5

Hi all,I am facing an issue in the generation of docx output.I am attaching the outputs that is obtained in both the rtf and docx output.In docx output the style is also getting printed with the output and the border lines also appear. My requirement is the same output in rtf to get in docx. Could please suggest the method in docx to get the similar output as in rtf.

7 REPLIES 7
ballardw
Super User

With code how can we make a suggestion of what might be needed?

 

I suspect the issue will revolve around setting the desired ODS STYLE on the ODS destination statement. But you will need to show the destination statements used for BOTH of those outputs.

AntuMaria
Calcite | Level 5

Hi,i have attached the sas code,dataset used and the obtained rtf output.How could i get a similar report in docx using ODS WORD?

ghosh
Barite | Level 11

This reference paper has helped me in using ODS WORD  (you do need SAS release 9.4m6)

 

https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2019/3235-2019.pdf 

AntuMaria
Calcite | Level 5

thank you..let me try with this one .

Cynthia_sas
SAS Super FREQ
Hi:
While ODS WORD may help you -- you're going to have some issues. First of all, your STYLE template uses the REPLACE statement, which was deprecated and made obsolete in SAS 9.2 with the introduction of the CLASS statement.
Next, the PROC REPORT code is full of RTF control strings. Those will not work with ODS WORD, so you'll have to change those.
What version of SAS are you running?
Cynthia
AntuMaria
Calcite | Level 5

Hi

I am using SAS 9.4 . I had checked with some docx control strings. But nothing worked in ODS WORD.

Cynthia_sas
SAS Super FREQ
Hi:
RTF stands for "Rich Text Format" -- it is a specification for how to describe an ASCII text document which contains RTF control strings that can be opened with many different word processors. As I remember, RTF was originally the format used to exchange documents between the PC and the Mac and other computers with different word processors. However, the docx format, is a Microsoft Open Office XML format for Word documents.
Although Microsoft Word can open a ASCII .RTF file, and Word can open a .DOCX file -- I would not expect a .docx file to contain RTF control strings. A .DOCX file is designed according to the Microsoft specification, which is different than the RTF specification.
If you want to create an RTF file and RTF gives you the style that you want. Just open the RTF file in Word and re-save it as a .DOCX file if you want to create a .DOCX file using ODS WORD, then you'll need to change your code to get rid of the RTF control strings and replace them with other controls. You may want to open a track with Tech Support on how to generate what you want with ODS WORD. But using RTF control strings inside ODS WORD will probably NOT work.

Cynthia

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