BookmarkSubscribeRSS Feed
Jolly
Calcite | Level 5

I am trying to find a way to control the title of my charts.  The basic example of my code it:

ods graphics on / reset=all width=9in height=5.5in;

options nonumber nodate orientation=landscape topmargin=1in bottommargin=0.25in rightmargin=0.25in leftmargin=0.25in;

ods rtf file="G:\QA\Product Compliance\Product Compliance\AQRs\Working\&filepath\chartstest.rtf"

style=statistical nogtitle startpage=no;

ODS ESCAPECHAR='^';

title justify=left "^S={preimage='G:\QA\Product Compliance\Product Compliance\AQRs\Templates\KU Logo.jpg'}"

justify=center "Monthly Complaint Report"

/*justify=right "Page ^{pageof}"*/;

title2 "Run Charts and Results by Test";

proc shewhart data=complaintsvssales;

where product="&product";

cchart count*month;

run;

ods rtf close;

ods graphics off;

The ODS titles are creating my header with our complany Logo in the top left with the title "Monthly Complaint Report" in the middle.  The title2 statement is creating the second title in the header.  But the problem is, how do I change the chart title now?  I am running about 40 charts at a time, so I want the chart title to be something like "CChart for &product by Month"  where &product is a called variable.

Thanks,

Jeff

4 REPLIES 4
ballardw
Super User

If you data has a single product with multiple values such as product 1, product 2 etc.  you would have an opportunity for cleaner code using BY group processing,

Try instead of the where clause:

by product; to see if you get multiple graphs.

Cynthia_sas
Diamond | Level 26

Hi:

  BallardW is correct. If you switch to BY group processing, you can use the special #BYVAL variable in your code. See below.

Cynthia

data Trucks4;

   input Day Defects Ntrucks @@;

   label Day='Day'

         Defects='Number of Paint Defects';

   ** make 3 products all charts will be the same;

   product = 'AAA'; output;

   product = 'BBB'; output;

   product = 'CCC'; output;

   datalines;

1   5  1    2   9  3

3   5  2    4   9  2

5  24  4    6  10  2

7  15  3    8  17  3

9  16  3   10  13  2

11  28  4   12  18  5

13   8  2   14   7  2

15   5  1   16  17  3

17   2  1   18  17  3

19  15  4   20  19  5

21   6  3   22  23  5

23  27  4   24   6  2

25  12  2   26  12  3

;

run;

 

proc sort data=trucks4;

by product;

run;

 

ods _all_ close;

options nobyline;

  

ods graphics on / reset=all width=9in height=5.5in;

options nonumber nodate orientation=landscape topmargin=1in bottommargin=0.25in rightmargin=0.25in leftmargin=0.25in;

ods rtf file="c:\temp\chartstest.rtf" style=statistical nogtitle startpage=no;

   

title justify=left "Logo here" justify=center "Monthly Complaint Report";

title2 "Run Charts and Results by Test";

title3 'for Product #byval1';

   

proc shewhart data=trucks4;

  by product;

   cchart defects*Day ;

run;

ods rtf close;

ods graphics off;

options byline;


see_by_group_info.png
Jolly
Calcite | Level 5

That works great when I can actually use the by statement, but what about times when I cannot use the statement?  Most of the time I am working with one particular product and running test using Proc Shewhart with ODS, I have my header titles that I can control, but how do I change, for instance, the title of an irchart, "Individual Measurements Chart for variable" while using ODS?  One thing specific would be changing "c Chart for Complaints" to "c Chart for Overall Complaints."

Thank you,

Jeff

Cynthia_sas
Diamond | Level 26

Hi:

  To change the "internal" title in the Shewhart-produced chart "c Chart for Complaints", you would have to change the Graph Template used by PROC SHEWHART. The ODS GRAPHICS documentation and the Graph Forum have had postings about how to do this.

cynthia

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 4 replies
  • 2363 views
  • 6 likes
  • 3 in conversation