BookmarkSubscribeRSS Feed
GG_DH
Calcite | Level 5

I am trying to assign page numbers for table of contents .like below : 2,7 are page numbers 

 

Q1                            ABCD.....................................................2

q2                             XYZA......................................................7   

 

 

3 REPLIES 3
ballardw
Super User

@GG_DH wrote:

I am trying to assign page numbers for table of contents .like below : 2,7 are page numbers 

 

Q1                            ABCD.....................................................2

q2                             XYZA......................................................7   

 

 


First, it may help to provide how you are creating the output that should have the output. The basic approach varies a bit between the types of ODS output you create such as PDF or RTF. Some ODS destinations do not have the concept of page so this would get somewhat more problematic in that case.

 

Second, are you attempting to assign a specific value or have the page number that a SAS output object (table or graph) appears on as generated by code?

And what is Q1 and Q2 doing there?

GG_DH
Calcite | Level 5

ODS output is created as RTF.Q1 and Q2 are question numbers

ballardw
Super User

Here is a very brief example of creating an RTF document with a table of contents. The first tricky part is that you have to tell Word (or likely other word processor or viewer program) to display the table. When you open the RTF file generated below you have to right click just below the "Table of Contents" text and select the "update table" from the menu. If that option is not there then you may need to try clicking somewhere left, right or closer the table of contents.

Specify a path for the output on your computer.

ods rtf file="<path>\junk.rtf"
style=meadow contents toc_data;

Title "Print of SASHELP.Class";
proc print data=sashelp.class;
run;

title "Age summary from Sashelp.class";
proc means data=sashelp.class;
   var age;
run;
title;
ods rtf close;

The table of contents will generally hold things like procedure name, title statements and By group results. Some procedures have options like Description or Contents that may also generate output for the Table of contents.

You can change the default procedure text using the ODS PROCLABEL statement. Or ODS Proctitle/noproctitle to suppress procedure descriptions.

So, how do you intend to get "question numbers" into those?

 

And you may end up in Proc Document to assemble things if the defaults don't work quite as you want.

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