Help using Base SAS procedures

Modify thecontrol limits and the zone colors in Shewhart IR charts

Reply
Occasional Contributor
Posts: 19

Modify thecontrol limits and the zone colors in Shewhart IR charts

Hi!

I'm trying to reproduce the  colors in the Shewhart IRChart like it is shown bellow.

I've succeded doing the chart, changing the upper and lower limits, changing the labels, changing the color of the zone between the UCL and LCL, but I want 3 zones, with 3 colors... I've tried with interpol statement, with pattern statement, and here's my code... I can't give you the datas that comes with it, unfortunately...

/******Here's the control limits I used***************/

data limcarte1;

_var_="diff";

_subgrp_="ID";

_type_="STANDARD";

_alpha_=0.002699796;

_sigmas_=3;

_limitn_=2;/*****sous groupe pour la partie moving range**/

_LCLI_=-0.66;

_UCLI_=0.66;

_Mean_=0;

_LCLR_=0;

_R_=1;

_UCLR_=3;

_stddev_=0.22;

run;

/********** here's the code**************/

title "essais irchart";

/****/

ods graphics off;

ods html close;

ods listing;

options odsstyle=default;

/****/

proc Shewhart data=cartetest1 limits=limcarte1 ;

symbol v=dot;

irchart diff*id / haxis=0 to 45 by 5

vaxis=-1.1 to 1 by 0.22

limitn=2

nochart2 /* enlève la 2e charte de R*/

zones

lzones=2 /*traits pointillés*/

cinfill=orange

ltmplot=histogram

ltmargin=25

nohlabel

cframe=white /*Couleur à l'extérieur de la zone limite*/

/*vref= 0.33 pour mettre des lignes horizontales*/

UCLLABEL='0.66'

LCLLABEL='-0.66'

xsymbol='0'

LSL=-0.44

zonelabels

zonevalpos=1

tests=1 2 3 5;

 

run;

 

I've been searching for more than two days... Can you help me with it please? Thank you so much!

here's what I want:Shewhart chart.png

 

 

 

Here's what I have.... :\

 Shewhart chart my result.png

Marie-Christine Bélanger

Secteur statistique et traitement des données

Direction du laboratoire des chaussées Ministère des Transports, de la Mobilité durable et l’Électrification des transports

 

SAS Employee
Posts: 8

Re: Modify thecontrol limits and the zone colors in Shewhart IR charts

Hi Marie-Christine,

 

PROC SHEWHART does not provide an option to fill the zones with different colors, but you can accomplish this by using ODS Graphics with a modified ODS style.  The following statements produce the chart that is shown below:

 

data foo;
   do group = 1 to 40;
      x = rannor(123);
      output;
   end;
run;

proc template;
   define style Styles.Custom;
   parent = Styles.HTMLBlue;
      Class GraphColors /
         "gzonea" = cxEB6F09
         "gzoneb" = cxFFFF68
         "gzonec" = cx4A8E5A
  ;
   end;
run;

ods listing style=Custom;
ods graphics on;

proc shewhart data=foo;
   irchart x * group /
      zonelabels
      markers
      nochart2
      ltmplot=histogram
      odstitle="essais irchart"
      ;
run;

 

IChart12.png

 

Note that not all the PROC SHEWHART options that apply to traditional graphics output (ODS Graphics disabled), e.g. LZONES=, apply when ODS Graphics is enabled. 

Occasional Contributor
Posts: 19

Re: Modify thecontrol limits and the zone colors in Shewhart IR charts

Posted in reply to BuckyRansdell

Hi! Thanks for your quick answer! Althought I have the same graphic with your code, the colors stay the same (blue)... I was told that it could maybe be caused by my version of SAS... (9.3). To get colors in a graphic, I had to put these code lines before proc Shewhart:

/****/

ods graphics off;

ods html close;

ods listing;

options odsstyle=default;

/****/

graphique bleu.png

 

What should I do to combine both?

Thank you very much!!

 

Marie-Christine

Super User
Posts: 11,343

Re: Modify thecontrol limits and the zone colors in Shewhart IR charts


bemariec wrote:

Hi! Thanks for your quick answer! Althought I have the same graphic with your code, the colors stay the same (blue)... I was told that it could maybe be caused by my version of SAS... (9.3). To get colors in a graphic, I had to put these code lines before proc Shewhart:

/****/

ods graphics off;

ods html close;

ods listing;

options odsstyle=default;

/****/

 


You don't show where you set the style Custom as created for the solution. Did you try ods listing style=Custom; instead of

ods listing;

options odsstyle=default;

Occasional Contributor
Posts: 19

Re: Modify thecontrol limits and the zone colors in Shewhart IR charts

Hi!

I've recopy exactly the same code as you, just to try again and here's the warning message (I've also tried with my collegue's version (9,4) and it is an error message instead of warning...) :

 

49 ods listing style=Custom;

WARNING: Could not restore referenced object: HTMLBlue.

WARNING: Could not find parent template: HTMLBlue.

50 ods graphics on;

 

I've been working with SAS (and programing language in general) for almost 3 weeks now, so I still struggle with basics :\ .Thanks for your help and patience! Smiley Happy

Occasional Contributor
Posts: 19

Re: Modify thecontrol limits and the zone colors in Shewhart IR charts

I've joined the complete log message!!

 

Thanks!

SAS Employee
Posts: 8

Re: Modify thecontrol limits and the zone colors in Shewhart IR charts

The ODS style elements that enable you to control the fill colors for the zones independently were added for SAS 9.4.  I don't know of a way to produce a control chart with different colors in the zones in an earlier release.

Super User
Posts: 11,343

Re: Modify thecontrol limits and the zone colors in Shewhart IR charts

From your log: SAS/STAT 12 => SAS 9.2 of some flavor I believe and nearly 10 years old depending on specific version. So there have been many changes to the graphics options and supplied ODS styles since.

Ask a Question
Discussion stats
  • 7 replies
  • 670 views
  • 3 likes
  • 3 in conversation