BookmarkSubscribeRSS Feed
tburus
Obsidian | Level 7

I am trying to create a table of contents and would like to style it as in the picture below. I can get part way there using a PICTURE format on the page number with FILL='.', but am limited to 16 leading periods. Is there a way to get a row to fill all leading/trailing space with periods, or some other way to make a horizontal row of periods?

toc.png

8 REPLIES 8
ChrisNZ
Tourmaline | Level 20

It seems to me that the issue is the calculation of the number of dots to add, since the font is proportional rather than with a fixed pitch. 

tburus
Obsidian | Level 7
I'm not sure I understand your comment. Do you mean calculating how many trailing dots I would need after the strings? I can't find any way around the limitation on leading dots with the current set up I'm using.
Amir
PROC Star

Hi,

 

If you know or can calculate how many periods are required then would the repeat() function be of any help?

 

https://documentation.sas.com/?docsetId=lefunctionsref&docsetTarget=p0p9jw1m2698fvn1ljrnc8b6gij6.htm...

 

 

Kind regards,

Amir.

RichardDeVen
Barite | Level 11

How is the table of contents created ?

Are you using ODS PDF option CONTENTS=yes ?

 

This example generates a TOC with dot fills:

ods _all_ close;

ods pdf file='report.pdf'
  contents=yes
;

proc print data=sashelp.class;
proc report data=sashelp.class;
run;

ods pdf close;

RichardADeVenezia_0-1589896478577.png

 

tburus
Obsidian | Level 7

Thank you, I know. But I can't find a way to get that ToC to appear after the cover page, and I would need to style it and tag everything appropriately, which would be a lot more work than what I'm doing.

RichardDeVen
Barite | Level 11

Do you have any working code that comes even reasonably close ?  Are you able to share any of it ?  What code is being used to create the pdf ? Which procedures ? PRINT/REPORT/TABULATE/SUMMARY/UNIVARIATE/SGPLOT/SPC/GMAP, etc...?  ODS TEXT statements? DATA step ODSOUT component objects ? Proc ODSTEXT ?

tburus
Obsidian | Level 7

I'm using ODS PDF to output. My document contains PROC REPORT, PROC TABULATE and PROC SGRENDER. I tried dummying a row of ... into a PROC REPORT by defining a column called 'dots' where I said,

compute dots;
dots = repeat('.', 500);
endcomp;

But it didn't like this (threw an error and converted to numeric) and only printed a single dot.

RichardDeVen
Barite | Level 11
The REPORT documentation is your friend .

COMPUTE Statement
<>

Computed character columns have a max length of 200.

You want

compute dots / character length=200
dots=repeat('.',199);
endcomp;

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