I have a script that imports production data, manipulates it, and then creates three control charts to monitor nonconformace rates in three different departments. Lately when I run the script it will only create two of the control charts. When I try to create the third one manually it gives the error "For P Chart, data should either be proportions and counts, but not both." I double checked the data set for anonolies, but it looks fine and all the values are proportions, in decimal form or 0, and less than 1 similar to the data for the other two control charts. What's odd is that if I copy and paste the data into a new column and use that to create the control chart there are no issues. I've attached a copy of the data set in question and here's the section of the script regarding the control charts:
//********************Create Dry Production Control Chart********************//
//Set SM as current data table
SM << Current Data Table();
//Create a subset of SM of all the Dry Production data - Dry Production Subset (DP)
SM << Select Where( :DEPT Group == "Dry Production");
DP = SM<<Subset((Selected Rows), Output Table Name("Dry Production Subset"));
//Save Dry Production Subset
DP << save("S:\depts\development\CURRENT Employees\Annie\NC Analysis\Biweekly Ops Control Charts\Generated Files\Dry Production Subset.jmp");
//Create summary table from Wet Production Subset to display the data by date rather than by lot - Wet Prodcution Summary (WS)
DS = DP << Summary(
Group(Date),
Sum(Numerator), Sum(Denominator),
Output Table Name("Dry Production Summary"),
Link to original data table(0)
);
//Select the last 30 days of data to use for the control chart
//One day data lag to allow time for all NC data to be entered
DS << Select Rows(Index((NRow()-1),(NRow()-31)));
DS <<Invert Row Selection<<Hide and Exclude;
New Column( "NC Rate", Numeric, Continuous, Format( "Best", 12 ), Formula(:Name( "Sum(Numerator)" ) / :Name("Sum(Denominator)")));
//Save Dry Production Summary
DS << save("S:\depts\development\CURRENT Employees\Annie\NC Analysis\Biweekly Ops Control Charts\Generated Files\Dry Production Summary.jmp");
//Create Dry Production Control Chart
Control Chart(
Sample Label( :Date ),
Sample Size( 100 ),
KSigma( 3 ),
Chart Col( :NC Rate, P ),
SendToReport(
Dispatch(
{},
"Control Chart",
OutlineBox,
{Set Title( "Dry Production" )}
),
Dispatch(
{},
"P of NC Rate",
OutlineBox,
{Set Title( "Control Chart (past 30 days)" )}
),
Dispatch( {"P of NC Rate"}, "", AxisBox, {Add Axis Label( "NC Rate" )} ),
Dispatch(
{"P of NC Rate"},
"Proportion for NC Rate",
TextEditBox,
{Set Text( "NC Rate" )}
),
Dispatch(
{"P of NC Rate"},
"1",
ScaleBox,
{Min( NRows()-31.2), Max(NRows() - 0.8 ), Inc( 1 ), Minor Ticks( 0 ),
Rotated Labels( "Vertical" )}
),
Dispatch(
{"P of NC Rate"},
"Attributes Chart",
FrameBox,
{Frame Size( 1004, 488 ), Line Width Scale (1.5)}
)
)
);
//************************************************************//
//********************Create Shipping Control Chart********************//
//Set SM as current data table
SM << Current Data Table();
//Create a subset of SM of all the Dry Production data - Shipping Subset (SH)
SM << Select Where( :DEPT Group == "Shipping");
SH = SM <<Subset((Selected Rows), Output Table Name("Shipping Subset"));
//Save Shipping Subset
SH << save("S:\depts\development\CURRENT Employees\Annie\NC Analysis\Biweekly Ops Control Charts\Generated Files\Shipping Subset.jmp");
//Create summary table from Wet Production Subset to display the data by date rather than by lot - Shipping Summary (SS)
SS = SH << Summary(
Group(Date),
Sum(Numerator), Sum(Denominator),
Output Table Name("Shipping Summary"),
Link to original data table(0)
);
//Select the last 30 days of data to use for the control chart
//One day data lag to allow time for all NC data to be entered
SS << Select Rows(Index((NRow()-1),(NRow()-31)));
SS <<Invert Row Selection<<Hide and Exclude;
New Column( "NC Rate", Numeric, Continuous, Format( "Best", 12 ), Formula(:Name( "Sum(Numerator)" ) / :Name("Sum(Denominator)")));
//Save Shipping Production Summary
SS << save("S:\depts\development\CURRENT Employees\Annie\NC Analysis\Biweekly Ops Control Charts\Generated Files\Shipping Summary.jmp");
//Create Shipping Control Chart
Control Chart(
Sample Label( :Date ),
Sample Size( 100 ),
KSigma( 3 ),
Chart Col( :NC Rate, P ),
SendToReport(
Dispatch(
{},
"Control Chart",
OutlineBox,
{Set Title( "Shipping" )}
),
Dispatch(
{},
"P of NC Rate",
OutlineBox,
{Set Title( "Control Chart (past 30 days)" )}
),
Dispatch( {"P of NC Rate"}, "", AxisBox, {Add Axis Label( "NC Rate" )} ),
Dispatch(
{"P of NC Rate"},
"Proportion for NC Rate",
TextEditBox,
{Set Text( "NC Rate" )}
),
Dispatch(
{"P of NC Rate"},
"1",
ScaleBox,
{Min( NRows()-31.3), Max(NRows()-0.8 ), Inc( 1 ), Minor Ticks( 0 ),
Rotated Labels( "Vertical" )}
),
Dispatch(
{"P of NC Rate"},
"Attributes Chart",
FrameBox,
{Frame Size( 1004, 488 ), Line Width Scale (1.5)}
)
)
);
//************************************************************//
//********************Create Wet Production Control Chart********************//
//Set SM as current data table
SM << Current Data Table();
//Create a subset of SM of all the Wet Production data - Wet Production Subset (WP)
SM << Select Where( :DEPT Group == "Wet Production");
WP = SM<<Subset((Selected Rows), Output Table Name("Wet Production Subset"));
//Save Wet Production Subset
WP<< save("S:\depts\development\CURRENT Employees\Annie\NC Analysis\Biweekly Ops Control Charts\Generated Files\Wet Production Subset.jmp");
//Create summary table from Wet Production Subset to display the data by date rather than by lot - Wet Prodcution Summary (WS)
WS= WP << Summary(
Group(Date),
Sum(Numerator), Sum(Denominator),
Output Table Name("Wet Production Summary"),
Link to original data table(0)
);
//Select the last 30 days of data to use for the control chart
//Two day data lag to allow time for all NC data to be entered
WS << Select Rows(Index((NRow()-2),(NRow()-32)));
WS <<Invert Row Selection<<Hide and Exclude;
New Column( "NC Rate", Numeric, Continuous, Format( "Best", 12 ), Formula(:Name( "Sum(Numerator)" ) / :Name("Sum(Denominator)")));
//Save Wet Production Summary
WS << save("S:\depts\development\CURRENT Employees\Annie\NC Analysis\Biweekly Ops Control Charts\Generated Files\Wet Production Summary.jmp");
//Create Wet Production Control Chart
Control Chart(
Sample Label( :Date ),
Sample Size( 100 ),
KSigma( 3 ),
Chart Col( :NC Rate, P ),
SendToReport(
Dispatch(
{},
"Control Chart",
OutlineBox,
{Set Title( "Wet Production" )}
),
Dispatch(
{},
"P of NC Rate",
OutlineBox,
{Set Title( "Control Chart (past 30 days)" )}
),
Dispatch( {"P of NC Rate"}, "", AxisBox, {Add Axis Label( "NC Rate" )} ),
Dispatch(
{"P of NC Rate"},
"Proportion for NC Rate",
TextEditBox,
{Set Text( "NC Rate" )}
),
Dispatch(
{"P of NC Rate"},
"1",
ScaleBox,
{Min( NRows()-32.3), Max(NRows()-1.8 ), Inc( 1 ), Minor Ticks( 0 ),
Rotated Labels( "Vertical" )}
),
Dispatch(
{"P of NC Rate"},
"Attributes Chart",
FrameBox,
{Frame Size( 1004, 488 ), Line Width Scale (1.5)}
)
)
);
//************************************************************//