BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
acordes
Rhodochrosite | Level 12

I want ods to create a table of content. 

But it is empty. 

I'd like to reference in the TOC every table the proc generates. 

 

the trace on statement reveals the distinct tables:

 

Output Added:
-------------
Name: NObs
Label: Number of Observations
Template: freqTab.freqTab.NObs
Path: CAS.freqTab.NObs
-------------
Output Added:
-------------
Name: LevelInfo
Label: Variable Level Information
Template: freqTab.freqTab.LevelInfo
Path: CAS.freqTab.LevelInfo
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table1.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table2.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table3.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table4.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table5.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table6.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table7.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table8.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table9.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table10.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table11.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table12.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table13.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table14.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table15.OneWayFreqs
-------------
Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table16.OneWayFreqs
-------------
Output Added:
-------------
Name: Timing
Label: Timing
Template: freqTab.freqTab.Timing
Path: CAS.freqTab.Timing
-------------
Output Added:
-------------
Name: OutputCasTables
Label: Output CAS Tables
Template: CAS.Common.OutputCasTables
Path: CAS.freqTab.OutputCasTables

 

 

And I have another challenge. How Do I output comments to the destination?

Imagine having a proc freq followed by a proc sgplot.

I want to add a comment lines BETWEEN the proc output so that I can guide the reader. 

 

pic.png

ods word file="/caslibs/marketing/&tab._topn.docx" options(contents="on" toc_data="on" keep_next="on");
title "Top 10 Freq";
ods proclabel=" ";

proc cas;   action freqTab.freqTab /displayOut={names={"OneWayFreqs"="out2"}} 
tabDisplay={format= "list", maxLevels=10,missingFreq=false} order= "FREQ", 
descending=false,table={name="ALEX_PPNC_HIST_V1", caslib="&casy."}      
tabulate={'Mes_Actual', 'Codigo_marca', 'Mes_actual_poliza', 'Tipo', 'Tipo_de_tarifa_de_seguro', 'Num_Siniestros', 
'Top_modelo', 'Grupo_duracion_contrato', 'Meses_contables_operacion', 'Tipo_de_cliente', 'Estado_operacion', 'Poliza_cancelada', 
'Operacion_viva', 'Poliza_en_riesgo_informe_TAM', 'Anyo_Vencimiento_operacion', 'NIF_CIF'};
run;

ods word close;

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Last time I checked ODS WORD is still not production.

I would recommend ODS RTF and then if a docx file format is required to use your word processor to change from RTF to docx.

View solution in original post

4 REPLIES 4
acordes
Rhodochrosite | Level 12

Ok, with an ODS text="your text"; line I can add text between proc outputs.

 

In the generated docx I can select the table to "insert caption". Then I create a table of figures and it recognizes the different tables.

Can I force the tables to have caption, i.e. the pathname from the trace log?

 

Output Added:
-------------
Name: OneWayFreqs
Label: One-Way Frequencies
Template: freqTab.freqTab.OneWayFreqs
Path: CAS.freqTab.Table2.OneWayFreqs

 

 

acordes
Rhodochrosite | Level 12

I've seen that the ods pdf generates what I'm looking for.

But can ods word do the same?

 

pic1.png

 

ballardw
Super User

Last time I checked ODS WORD is still not production.

I would recommend ODS RTF and then if a docx file format is required to use your word processor to change from RTF to docx.

cminard
Quartz | Level 8

Word does not automatically display the TOC.

1. Generate your word document.

2. press ctrl+a to select all (i.e., the entire document)

3. press f9

 

https://support.sas.com/resources/papers/proceedings20/4265-2020.pdf

Note that Word doesn't automatically display the TOC when you open the document. You
can manually display the TOC by pressing CTRL+A F9 on your keyboard. Another Word tip:
If you jump f rom the TOC to the body of the report, then you can jump back to the TOC by
pressing ALT ←.

 

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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