BookmarkSubscribeRSS Feed
mmkr
Quartz | Level 8

 

How do i remove from table of contents just one variable (not all)

 

I jsut want to remove age from table of contents but show sex 

as by variable have 2 variables sex and age but table of contents i need only one show up

 

Code :

 

proc sort data=sashelp.class out=output;by sex age;run;
proc freq data=output noprint;
table age/out=age;
run;

%macro report(age=);
proc report data=output nowd;by sex age;
where age=&age.;
run;
ods pdf startpage=now;
proc odstext;
p 'Signature: ________________'/style={fontsize=8 just=r};
run;
%mend;


ods pdf file='c:\temp\temp.pdf' ;
options nodate nonumber;
title j=r ' PageNo:(*ESC*){thispage} ';

data _null_;
set age;
call execute(catt('%report(age=',age,')'));
run;

ods pdf close;

 

 

mmkr_0-1719321734989.png

 

3 REPLIES 3
SASJedi
SAS Super FREQ

In your report macro, remove AGE from the PROC REPORT BY statement:

proc report data=output nowd;by sex ;
Check out my Jedi SAS Tricks for SAS Users
mmkr
Quartz | Level 8

I do want in by statment but i don't want in to table of contents

ballardw
Super User

Look at the ODS PDF option PDFTOC=n. If N is 1 then only one level should appear in the TOC, 2 levels, etc. For your example I think that you want PDFTOC=1The default is 0 which means "all levels".

 

Note that only the LAST specification of the option is used in the document, so while multiple settings on different ODS PDF statements for the same document are not syntax errors only the last one will be applied when the document is displaye.

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

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