I'm trying to create a table of contents, wiith amacro variable in one of the "nodes" - have tried a LOTS of different things, but no success. Below is an example with stripped down code - i would like to have the "District" variable in the Table of Contents, but can get nothing but:
The SGPLOT Procedure...1
SGPLOT-.........................1
The SGPLOT Procedur......2
SGPLOT...........................2
Any sugggestions would be greatly appreaciated!
Dave
data a;
input id district $ value;
datalines;
1 A 1
2 B 1
3 C 1
;
ods pdf file = "C:\a\test.pdf" contents;
%macro x1;
%do k = 1 %to 3;
data plot; set A (where = (id = &k));
if _n_ = 1 then call symput("DST", strip(District));
contents=&dst
run;
title1 "&DST -- Grade = &i";
proc sgplot;
scatter x=district y= value;
run;
%end;
%mend;
%x1;
ods pdf close;
The DESCRIPTION option on the SGPLOT statement should give you the ability to customize the TOC entry.
Thank you for the quick reply - that was one of the many things i had tried, but couldn't get it to work - when i try adding it in (in the code, below) i get the same TOC (the "TEST" doesn't show up, just the "The SGPLOT Procedure" and "SGPLOT")
data a;
input id district $ value;
datalines;
1 A 1
2 B 1
3 C 1
;
ods pdf file = "C:\a\test.pdf" contents;
%macro x1;
%do k = 1 %to 3;
data plot; set A (where = (id = &k));
if _n_ = 1 then call symput("DST", strip(District));
run;
title1 "&DST ";
proc sgplot DESCRIPTION= "TEST" ;
scatter x=district y= value;
run;
%end;
%mend;
%x1;
ods pdf close;
Have you tried resetting your SAS Studio or SAS EG following these instructions?
You may also have an
options nolabel;
setting written somewhere in your code which may be causing an issue.
Hope this helps!
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.
Ready to level-up your skills? Choose your own adventure.