BookmarkSubscribeRSS Feed
xxformat_com
Barite | Level 11

Here I'm using proc report with a by statement and  proc document to create a table of contents in a PDF file.

I'm wondering why "Level 3" is not displayed by in the list statement output of proc document

and why renaming the Table Item with setlabel creates a new item in the TOC.

 

1. Default Labels in the TOC

 

 

proc sort data=sashelp.class out=class;
    by sex;
run;

ods document name=test(write); 
	proc report data=class;
	    by sex;
	    column name age height weight;
	    define name   / display;
	    define age    / display;
	    define height / display;
	    define weight / display;
	run;
ods document close; 
 
ods pdf file ="&xxtest./reporting/test.pdf";

proc document name=test;    
    replay;
    run; 
quit;

ods pdf close; 

 

 

basic.JPG

 

2. Using labels from proclabel and contents

 

 

options label;

proc sort data=sashelp.class out=class;
    by sex;
run;

data class;
   set class;
   retain tmp 1;
run;

ods document name=test(write); 
    ods proclabel 'Level 1'; 
	proc report data=class contents='Level 2';
	    by sex;
	    column tmp name age height weight;
	    define tmp    / order noprint;
	    define name   / display;
	    define age    / display;
	    define height / display;
	    define weight / display;
	    break before tmp / page contents='Level 3';
	run;
ods document close; 
 
ods pdf file ="&xxtest./reporting/test.pdf";

proc document name=test;    
    replay;
    run; 
quit;

ods pdf close; 

 

 

 

basic2.JPG

 

3. Using proc document

 

 

options label;

proc sort data=sashelp.class out=class;
    by sex;
run;

data class;
   set class;
   retain tmp 1;
run;

ods document name=test(write); 
    ods proclabel 'Level 1'; 
	proc report data=class contents='Level 2';
	    by sex;
	    column tmp name age height weight;
	    define tmp    / order noprint;
	    define name   / display;
	    define age    / display;
	    define height / display;
	    define weight / display;
	    break before tmp / page contents='Level 3';
	run;
ods document close; 

proc document name=test;    
    list/levels=all details;
	run;
quit;

proc document name=test;   
    setlabel \Report#1\ByGroup1#1\Report#1\Report#1 '4.1';
    setlabel \Report#1\ByGroup2#1\Report#1\Report#1 '4.2';

    setlabel \Report#1\ByGroup1#1\Report#1 '3.1';
    setlabel \Report#1\ByGroup2#1\Report#1 '3.2';

    setlabel \Report#1\ByGroup1#1 '2.1';
    setlabel \Report#1\ByGroup2#1 '2.2';

    setlabel \Report#1 '1';
    
    list/levels=all  details;

	run;
quit;

 
ods pdf file ="&xxtest./reporting/test.pdf";

proc document name=test;    
    replay;
    run; 
quit;

ods pdf close; 

list.JPG

 

I'm wondering why "Level 3" is not displayed in the list statement output.

 

basic3.JPG

 

We can see that renaming the Table item creates a new entry on the last level rather than the one available at that level.

 

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 0 replies
  • 670 views
  • 0 likes
  • 1 in conversation