BookmarkSubscribeRSS Feed
janpeter
Fluorite | Level 6

Hi

 

my question is whether there is a way to collect existing files (txt, png, rtf etc) into a word document (docx) and create a TOC?

 

Building a docx file from scratch is a possibility but if SAS already has this functionality then it would be good to be aware of it.

 

The desired output (docx) should contain the files according to a pre defined order.

 

ex Table 1 ... Table 10, Graph1, Table11 - Table13, Graph2 - Graph5, ...

 

So running the programs in a given order using ODS is not practical as there can easily become hundreds of them. 

 

BR
Jan

4 REPLIES 4
Cynthia_sas
Diamond | Level 26

Hi:

  If all the output is created by SAS and if you can run the programs and save the output objects in an ODS DOCUMENT store, then you can rearrange and replay the objects in the order/structure you make. See this paper https://support.sas.com/resources/papers/sgf09/318-2009.pdf and notice how, originally, the PROC TABULATE and the UNIVARIATE output is created and structured (on page 4, it shows all the TABULATE followed by all the UNIVARIATE).

 

  But, in the paper, the desired output is to have the results organized by country and not by procedure. So after storing the objects in a document store, the objects are restructured and replayed as shown on page 7, Figure 11.

 

  Alternately, you could write a SAS Macro program to control the creation of the results in the order you choose.

 

Hope this helps,

Cynthia

janpeter
Fluorite | Level 6

Hi Cynthia,

sorry for the very late reply. Thank you for your answer. it looks promising.

I would guess that this also works for docx? currently i have it as preproduction in my SAS version but it will most likely be the standard to go with in the future.

 

BR

jan

ChrisNZ
Tourmaline | Level 20

DOCX output support is coming but not totally there yet:

 

The SAS® Output Delivery System (ODS) destination for Word enables customers to deliver
SAS® reports as native Microsoft Word documents. The ODS WORD statement generates
reports in the Office Open XML Document (.docx) format  [8><] ODS WORD is preproduction in the
sixth maintenance release of SAS 9.4.

 

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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