Hello,
I am having an issue with my proc shewhart INSET values for CPK, CPKLCL, and CPKUCL. What I am doing is I have a set of data, for example n=60, and with this data I need to split the chart where a shift in the process/mean takes place. Such as there was a shift after data point 29, and starting with data point 30 I would want to calculated new control limits and capability estimates. I have no problems showing the shifts in the charts and calculating the new control limits for each range of data using the _PHASE_ and _INDEX_ options. Control limit and mean wise, everything looks great in the chart and aligns with the stats data set corresponding to the correct range of data. However, the Capability estimates, which I want based just on the last phase of data, are not matching to the limits. The current code I have has been provided below to help clear up the picture. The data is simple height versus observation number.
data physical;
set physical;
length _PHASE_ $2.;
if obs < 25 then _PHASE_ = 'A';
if obs >= 25 then _PHASE_ = 'B';
run;
(Phases created to determine with range of data gets which set of limits)
proc shewhart data=physical;
where obs < 25;
irchart Height*obs='*' / nochart2 totpanels=1 ciindices lsl=60 usl=80 outlimits=stats2;
inset stddev cpklcl='Cpk 95% Lower' cpk='Cpk' cpkucl='Cpk 95% Upper' / pos=nw format=6.2;
run;
(Creating the Stats2 data set to contain the limits for datapoints 1 through 24, or _PHASE_ 'A')
data stats2;
set stats2;
length _INDEX_ $2.;
_INDEX_ = 'A';
run;
(adding the _INDEX_ variable to match the limits dataset with the range of data that contains the corresponding _PHASE_ 'A')
proc shewhart data=physical;
where obs >= 25;
irchart Height*obs='*' / nochart2 totpanels=1 ciindices lsl=60 usl=80 outlimits=stats3;
inset stddev cpklcl='Cpk 95% Lower' cpk='Cpk' cpkucl='Cpk 95% Upper' / pos=nw format=6.2;
run;
(Creating the Stats3 data set to contain the limits for datapoints 25 through last data point, or _PHASE_ 'B')
data stats3;
set stats3;
length _INDEX_ $2.;
_INDEX_ = 'B';
run;
(adding the _INDEX_ variable to match the limits dataset with the range of data that contains the corresponding _PHASE_ 'B')
data stats;
set stats2 stats3;
run;
(stacking data sets stats2 and stats3 into one data set to be read into proc shewhart)
proc shewhart data=physical limits=stats;
irchart Height*obs='*' / nochart2 totpanels=1 ciindices lsl=60 usl=80 readindexes=all phaselegend;
inset stddev cpklcl='Cpk 95% Lower' cpk='Cpk' cpkucl='Cpk 95% Upper' / pos=nw format=6.2;
run;
(Here is the proc shewhart procedure in which I have the phases with their respective limits; however, the capability indices are not from stats3 - Which leads me to my question of how do I get the INSET statement to read the data directly from the stats for _PHASE_ B)
If I just run proc shewhart with obs >= 25, i get the correct capability information, but in the above procedure, it does not give me these sames estimates.
Any help is greatly appreciated.
Thank you,
Jeff S. O.
You already have the limits in a SAS data set. To get those values to appear in the inset, you can use the DATA step to create an inset data set. The inset data set contains the variables _LABEL_ and _VALUE_, and you can assign them any values you want. You use the DATA= keyword on the INSET statement to specify the name of the inset data set. This enables you to completely customize the inset to display whatever you want. See the Getting Started Example for the INSET statement.
You already have the limits in a SAS data set. To get those values to appear in the inset, you can use the DATA step to create an inset data set. The inset data set contains the variables _LABEL_ and _VALUE_, and you can assign them any values you want. You use the DATA= keyword on the INSET statement to specify the name of the inset data set. This enables you to completely customize the inset to display whatever you want. See the Getting Started Example for the INSET statement.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.