Hello all!
I have the example code as below, from which I want to develop a table of contents on the left side of the pdf file without the node 'table1', then I applied the example code to my own code, however, it ends up having the node'table1', do you know what to do with it? Thanks!
Example Code:
ods proclabel 'Section 1';
data example;
set sashelp.class;
holder=1;
run;
ods document name=mydocrep(write);
proc report nowd data=example(obs=2) contents='Group 1';
define holder / noprint order;
break before holder / page contents='';
run;
ods proclabel=' ';
proc report nowd data=example(obs=4) contents='Group 2';
define holder / noprint order;
break before holder / page contents='';
run;
ods proclabel=' ';
proc report nowd data=example(obs=4) contents='Group 3';
define holder / noprint order;
break before holder / page contents='';
run;
ods document close;
proc document name=mydocrep ;
move Report#2\Report#1 to report#1;
delete Report#2;
move Report#3\Report#1 to report#1;
delete Report#3;
run;
ods pdf file="/C:/Mtest293.pdf";
replay;
run;
ods pdf close;
quit;
My Own Code:
ods proclabel 'Section 1';
%macro report(product ,title,content);
Proc report data=&product. contents=&content.
style(header)={color=black background=cornflowerblue fontweight=bold }
style(column)={just=center background=snow foreground=black fontweight=bold};
title3 j=c color=black HEIGHT=14pt BOLD &title.;
footnote3" ";
column _name_ year2017 year2016 Num_of_Variance mature2016 Num_of_Variance2 y2017 y2016 Variance ;
define _name_ / "Metrics" style(column)=data[ foreground=negfmt.];
define year2017/ "&dt_Mon." style=[foreground=negfmt.];
define year2016/ " &dt_Mon_pre." style=[foreground=negfmt.];
define Num_of_Variance/ "# of Variance" style=[foreground=negfmt. width=0.9in];
define mature2016/ "Mature &dt_Mon_pre." style=[foreground=negfmt.];
define Num_of_Variance2/ "# of Variance" style=[foreground=negfmt. width=0.9in];
define y2017/ "YTD17" style=[foreground=negfmt.];
define y2016/ " YTD16" style=[foreground=negfmt.];
define Variance/ "# of Variance" style=[foreground=negfmt. width=0.9in];
compute _name_ ;
if _name_= 'Avg Score' then call define(_row_,'style','style={background=gainsboro}');
if _name_= 'Avg ApScore' then call define(_row_,'style','style={background=gainsboro}');
endcomp;
%macro comp(arg);
compute &arg;
If _name_='App' then call define(_col_,'format','comma20.0');
If _name_='CreAR' then call define(_col_,'format','percent8.1');
if _name_= 'JuAR' then call define(_col_,'format','percent8.1');
if _name_= 'Ref % ' then call define(_col_,'format','percent8.1');
if _name_= 'Avg Score' then call define(_col_,'format','comma8.0');
if _name_= 'Avg AppScore' then call define(_col_,'format','comma8.0');
if _name_= 'Cos %' then call define(_col_,'format','percent8.1');
if _name_= 'NF%' then call define(_col_,'format','percent8.1');
if _name_= 'Uppe %' then call define(_col_,'format','percent8.1');
if _name_= 'Grad%' then call define(_col_,'format','percent8.1');
if _name_='FIC%' then call define(_col_,'format','percent8.1');
if _name_='FI%' then call define(_col_,'format','percent8.1');
if _name_='Se %' then call define(_col_,'format','percent8.1');
endcomp;
%mend common_lines;
%comp(year2016);
%comp(year2017);
%comp( Num_of_Variance);
%comp(mature2016);
%comp( Num_of_Variance2);
%comp( y2017);
%comp(y2016);
%comp( Variance);
/* */
/* ods proclabel=' '; */
%mend;
ods pdf close;
ods document name=mydocrep(write);
%report (all_dqm, " All Products" ,'group1');
ods proclabel=' ';
%report (so_dqm, "SO " , 'group2');
ods proclabel=' ';
%report (pl_dqm, "PL " , 'group3');
ods proclabel=' ';
%report (ct_dqm, "CT " ,'group4');
ods proclabel=' ';
%report (bar_dqm, "BS " ,'group5');
ods proclabel=' ';
%report (mx_dqm, "MR",'group6');
ods document close;
proc document name=mydocrep ;
move Report#2\Report#1 to report#1;
delete Report#2;
move Report#3\Report#1 to report#1;
delete Report#3;
move Report#4\Report#1 to report#1;
delete Report#4;
move Report#5\Report#1 to report#1;
delete Report#5;
move Report#6\Report#1 to report#1;
delete Report#6;
run;
ods pdf file="/C:/Mtest28993.pdf";
replay;
run;
ods pdf close;
quit;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: