BookmarkSubscribeRSS Feed
Dave25
Quartz | Level 8

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;

 

 

3 REPLIES 3
DanH_sas
SAS Super FREQ

The DESCRIPTION option on the SGPLOT statement should give you the ability to customize the TOC entry.

Dave25
Quartz | Level 8

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;

 

Springyboy
Fluorite | Level 6

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!

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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