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
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.
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;
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
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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.