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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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