BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
_LB
Fluorite | Level 6 _LB
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
mcybrynski
SAS Employee


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

12 REPLIES 12
mcybrynski
SAS Employee


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

_LB
Fluorite | Level 6 _LB
Fluorite | Level 6

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

_LB
Fluorite | Level 6 _LB
Fluorite | Level 6

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

Cynthia_sas
SAS Super FREQ

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;        


purple_green_cyan.jpg
LB
Quartz | Level 8 LB
Quartz | Level 8

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

Cynthia_sas
SAS Super FREQ

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;


shewhart_pdf_green.jpg
LB
Quartz | Level 8 LB
Quartz | Level 8

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

;

mcybrynski
SAS Employee

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

LB
Quartz | Level 8 LB
Quartz | Level 8

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 

_LB
Fluorite | Level 6 _LB
Fluorite | Level 6

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

But a little further ahead.

Thanks.

Lawrence

mcybrynski
SAS Employee

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?

_LB
Fluorite | Level 6 _LB
Fluorite | Level 6

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 12 replies
  • 1933 views
  • 3 likes
  • 4 in conversation