Data visualization with SAS programming

proc shewhart, coverlay functionality in ods, and headers

Accepted Solution Solved
Reply
Regular Contributor
Regular Contributor
Posts: 170
Accepted Solution

proc shewhart, coverlay functionality in ods, and headers

Hello all,

I have a couple of questions concerning proc shewart.

The code is below but the problems are these:

1) In terms of the headers-If it is a long one it simply disappears. I have attempted to use the split function to no avail.

2) is there a work around the coverlay attribute in that I wish to change its color. It works in a non-ods environment but in ods it keeps the same color as the entries within the control limits. Attempts to change it simply make it red instead of blue. Can I go through a template?

3) is there a way to change the labels for the lcl,ucl, and mean.

4) Is there a way to set the  OVERLAYLEGLAB

to null-single or double quotes simply gives me a default "Overlay" descriptor or can I change the lable for the overlay variable.

Both the program and data are attached. Replace the import statement with the proper file location.

Thanks.

Lawrence

Attachment

Accepted Solutions
Solution
‎03-14-2012 02:39 PM
SAS Employee
Posts: 3

proc shewhart, coverlay functionality in ods, and headers


Hi-

Thanks for your questions. Hopefully these answers will help.  Let me know the answers are incomplete.

1) In terms of the headers-If it is a long one it simplydisappears. I have attempted to use the split function to no avail.

PROC SHEWHART has achart statement option to control this.  SeePHASELABTYPE= in the PROC SHEWHART Options Dictionary for the usage that is appropriate for your needs. The default is to HIDE labels that don't fit (which is not indicated in the documentation).  FYI, PROC SHEWHARTdoes not honor the ODS split functionality.

2)is there a work around the coverlay attribute in that I wish to change itscolor. It works in a non-ods environment but in ods it keeps the same color asthe entries within the control limits. Attempts to change it simply make it redinstead of blue. Can I go through a template?

The Java renderer for PROC SHEWHART uses the attributes from the GraphData2-n style elements.  You control the overlay line color by altering the color as follows.

proctemplate;

  definestyle styles.MyStyle;

parent=styles.default;

      classGraphData2/                                                    

         color= PINK;red

  end;

run;

3)is there a way to change the labels for the lcl,ucl, and mean.

PROC SHEWHART has chart statement options to control this. See LCLLABEL=, UCLLABEL=, and XSYBOL= for the appriate usage for your needs.

4)Is there a way to set the  OVERLAYLEGLAB tonull-single or double quotes simply gives me a default "Overlay"descriptor or can I change the lable for the overlay variable.

Unfortunately, there is a bug in the Java renderer used by PROCSHEWHART and there is no work around.

I hope that helps.

Mike

View solution in original post


All Replies
Solution
‎03-14-2012 02:39 PM
SAS Employee
Posts: 3

proc shewhart, coverlay functionality in ods, and headers


Hi-

Thanks for your questions. Hopefully these answers will help.  Let me know the answers are incomplete.

1) In terms of the headers-If it is a long one it simplydisappears. I have attempted to use the split function to no avail.

PROC SHEWHART has achart statement option to control this.  SeePHASELABTYPE= in the PROC SHEWHART Options Dictionary for the usage that is appropriate for your needs. The default is to HIDE labels that don't fit (which is not indicated in the documentation).  FYI, PROC SHEWHARTdoes not honor the ODS split functionality.

2)is there a work around the coverlay attribute in that I wish to change itscolor. It works in a non-ods environment but in ods it keeps the same color asthe entries within the control limits. Attempts to change it simply make it redinstead of blue. Can I go through a template?

The Java renderer for PROC SHEWHART uses the attributes from the GraphData2-n style elements.  You control the overlay line color by altering the color as follows.

proctemplate;

  definestyle styles.MyStyle;

parent=styles.default;

      classGraphData2/                                                    

         color= PINK;red

  end;

run;

3)is there a way to change the labels for the lcl,ucl, and mean.

PROC SHEWHART has chart statement options to control this. See LCLLABEL=, UCLLABEL=, and XSYBOL= for the appriate usage for your needs.

4)Is there a way to set the  OVERLAYLEGLAB tonull-single or double quotes simply gives me a default "Overlay"descriptor or can I change the lable for the overlay variable.

Unfortunately, there is a bug in the Java renderer used by PROCSHEWHART and there is no work around.

I hope that helps.

Mike

Regular Contributor
Regular Contributor
Posts: 170

proc shewhart, coverlay functionality in ods, and headers

Mike-

Thanks for the assistance & the FYI's on some of these parameters.

I will start to go through these bit by bit.

If I have any questions, I'l ask again.

Lawrence

Regular Contributor
Regular Contributor
Posts: 170

proc shewhart, coverlay functionality in ods, and headers

OK Mike-it all worked!  Except for the template part-it rendered the entire background an ugly grayish/green color.

Any more places to look for this would be great.

Thank for all your help thus far.

Lawrence

SAS Super FREQ
Posts: 8,641

Re: proc shewhart, coverlay functionality in ods, and headers

Hi:

  That sounds like you're getting the background of STYLES.DEFAULT -- which is a fairly ugly gray. Try using  either LISTING or HTMLBLUE in your PARENT statement.

  I used this code to change the colors and make the reference line GREEN. See attached screenshot.

cynthia

ods path work.tmp(update)

         sasuser.templat(update)

         sashelp.tmplmst(read);

              

proc template;

  define style styles.MyStyle;

  parent=styles.listing;

     class GraphData1 / contrastcolor=cyan;

     class GraphData2 / contrastcolor=purple;

     class GraphReference /

         linethickness = 3px

         linestyle = 2

         contrastcolor = green;

end;

run;

     

data one;

  y=5;

  do i=1 to 10;

     do j=1 to 5;

        x=rannor(12345);

        output;

     end;

  end;

run;

     

ods html path='c:\temp' (url=none)

         gpath='c:\temp' (url=none)

         file='shewhart.html' style=MyStyle;

  

proc shewhart data=one;

     xchart x*i/overlay=(y) vref = 2;

run;

ods html close;        

Attachment
Frequent Contributor
Frequent Contributor
Posts: 129

proc shewhart, coverlay functionality in ods, and headers

Cynthia-

OK, When I run it it as a PDF or RTF the overlay color reverts back to blue (but works in HTML just fine)

The Graphreference component does work properly however.

I am looking to change the overlay color and add symbols to it. Can I add to the GTL template

with a series plot or something similar.

x=month and y=otherrate

Is simply a ODS PDF issue?

Thanks again.

Lawrence

SAS Super FREQ
Posts: 8,641

Re: proc shewhart, coverlay functionality in ods, and headers

Hi:

  Did you use style=MyStyle (or whatever your style name was) with ODS RTF and ODS PDF? When I used the style that I created in my sample on the PDF and RTF invocation, I got a green line. It's a bit hard to see in the screen shot -- but the ref line is green. If you put STYLE= on the ODS PDF or ODS RTF invocation and you do not get the style template used, then you need to open a track with Tech Support.

cynthia

  My invocation code was:

ods rtf file='c:\temp\shewhart.rtf' style=MyStyle;

ods pdf file='c:\temp\shewhart.pdf' style=MyStyle;

ods html path='c:\temp' (url=none)

         gpath='c:\temp' (url=none)

         file='shewhart.html' style=MyStyle;

  

proc shewhart data=one;

     xchart x*i/overlay=(y) vref = 2;

run;

ods _all_ close;

Attachment
Frequent Contributor
Frequent Contributor
Posts: 129

proc shewhart, coverlay functionality in ods, and headers

Cynthia;

I did invoke the styles statement. However, what happens now is when I declare

the GraphData1 statement /color=black it renders both the overlay line black and the symbols on the main fitline black while keeping the color of the graphfit (main) line blue as requested.

WIll play with it some more.

Thanks for your help again.

Lawrence

proc

template

;

define style

styles.MyStyle;

parent=styles.listing;

class GraphFit / contrastcolor=blue linethickness=2px linestyle=1

;

class GraphReference / contrastcolor=green linethickness=1px linestyle=2

;

class GraphData1 /color=black linethickness=2px linestyle=1

;

end

;

run

;

SAS Employee
Posts: 3

proc shewhart, coverlay functionality in ods, and headers

Hi Lawrence.

Sorry you're having troubles.  I ran Shewhart and created RTF output.  Here is what I discovered.

  • There appears to be a bug in the Shewhart renderer such that reference line linestyle and linethickness are not being applied.
  • The reference line color is set from the GraphReference.contrastColor.
  • The overlay honors all GraphDataN (where n starts @ 2) element attributes.  The color is set using GraphDataN.color.
  • PROC Shewhart uses the chart statement options to control the chart appearance so there is no template for you to modify.
  • Use the OVERLAYSYM* options on your chart to add symbols to the overlay. 
  • Note, that the symbol values specified in these options are used to create indexes only (note the "blah" value). 
  • The symbol is then taken from the appropriate GraphDataN style element (see GraphDataN.markerSymbol).
  • The marker and the line will be the same color (probably not what you want). 
  • You may have to create a second overlay variable to draw the symbols with a different color.

This is the code I ran:

proc template;

  define style styles.MyStyle;

  parent=styles.listing;

     class GraphFit / contrastcolor=red linethickness=5px linestyle=2;

     class GraphReference / contrastcolor=orange linethickness=3px linestyle=2;

    

     class GraphData1 / color=black linethickness=5px linestyle=2;

     class GraphData2 / color=yellow linethickness=5px linestyle=3 markerSymbol='star';

    

end;

run;

    

data one;

  y=5;

  do i=1 to 10;

     do j=1 to 5;

        x=rannor(12345);

        output;

     end;

  end;

run;

    

ods rtf style=MyStyle;

 

proc shewhart data=one;

     xchart x*i/overlay=(y)

                overlaysym=(blah)

                vref = 2;

run;

 

ods rtf close;       

Hope this helps.

Mike

Frequent Contributor
Frequent Contributor
Posts: 129

proc shewhart, coverlay functionality in ods, and headers

Thanks Mike-Yes by using

GraphData1 it renders the overlay line the same color as the symbol on the main control line. It is a little frustrating.

Thanks for your input. This helps explain.

Lawrence 

Regular Contributor
Regular Contributor
Posts: 170

proc shewhart, coverlay functionality in ods, and headers

Ok Mike-substituted the overlay with a vref statement. Still can't get the green line.

But a little further ahead.

Thanks.

Lawrence

SAS Employee
Posts: 3

proc shewhart, coverlay functionality in ods, and headers

not sure why the template change is not working for you.  what version of SAS are you using?

try this program (it works for me at 9.30 + ):

proc template;

  define style styles.MyStyle;

parent=styles.default;

     class GraphData2 / color= PINK;

  end;

run;

data one; y=5; do i=1 to 10; do j=1 to 5; x=rannor(12345); output; end; end; run;

ods html style=MyStyle;

proc shewhart; xchart x*i/overlay=(y); run;

FYI, i noticed that my cut/paste of the template code removed blank characters.  was the template

code compiled without errors?  could that be the problem?

Regular Contributor
Regular Contributor
Posts: 170

proc shewhart, coverlay functionality in ods, and headers

Mike;

I am using 9.2. I am curious if it has to do with the ODS output-namely pdf.. 

Either way I replaced the overlay with the vref function for labeling purposes and the graphreference class seems to do the trick in this case. However your info on the phaselab,ucl,lcl labeling was a lifesaver-thank you.

Best

Lawrence

Post a Question
Discussion Stats
  • 12 replies
  • 635 views
  • 3 likes
  • 4 in conversation