cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
Giardini
Level II

Setting using JSL so that the control chart does not display batches for which there are missing data for a given parameter.

As the topic. 

Normally in JSL we indicate batches (represented by a given column) for which we present points on the control chart as follows:

 

Local Data Filter(
		Close Outline( 1 ),
		Add Filter(
			columns( :Batch ),
			Where(
				:Batch == {"01/10/2022", "01/11/2022", "01/12/2022", "01/13/2022"}
			),
			Display( :Batch, N Items( 15 ), Find( Set Text( "" ) ) )
		)
	),	

However, how can we request that all batches be taken into account, except those for which we have N/A (empty field in the data table) for a given parameter?

 

Version of JMP: 16.

 

7 REPLIES 7

Re: Setting using JSL so that the control chart does not display batches for which there are missing data for a given parameter.

One way would be to use an associative array to get all the unique values, then keep just the non-missing values. Then, you could pass this as a list to the local data filter. Example below:

Names Default To Here (1);
//open file and delete a few data points
dt = open ("$SAMPLE_DATA/Abrasion.jmp");

for each ({i}, 6::9,
	:Date[i] = .
);

//get non-missing 
lstdates = matrix (Associative Array (:Date) << Get Keys);
lstdates = as list(lstdates[loc(!Is Missing(lstdates))]);

//launch cc
cc = Control Chart Builder( Variables( Y( :Abrasion ) ), Show Control Panel( 0 ), );

//launch data filter
ldf = cc << Local Data Filter(
	Add Filter(
		columns( :Date ),
		Where( :Date == lstdates ),
		Display( :Date, N Items( 5 ) )
	)
);

/*JMP STATISTICAL DISCOVERY LLC (“JMP”) PERMITS THE USE OF THIS COMPUTER SOFTWARE CODE (“CODE”) ON AN AS-IS BASIS AND AUTHORIZES YOU TO USE THE CODE SUBJECT TO THE TERMS LISTED HEREIN.  BY USING THE CODE, YOU AGREE TO THESE TERMS.  YOUR USE OF THE CODE IS AT YOUR OWN RISK.  JMP MAKES NO REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRIGEMENT, AND TITLE, WITH RESPECT TO THE CODE.
You may use the Code solely as part of a software product you currently have licensed from JMP, JMP’s parent company SAS Institute Inc. (“SAS”), or one of JMP’s or SAS’s subsidiaries or authorized agents (the “Software”), and not for any other purpose.  The Code is designed to add functionality to the Software but has not necessarily been tested.  Accordingly, JMP makes no representation or warranty that the Code will operate error-free.  JMP is under no obligation to maintain, support, or continue to distribute the Code.
Neither JMP nor its licensors shall be liable to you or any third-party for any general, special, direct, indirect, consequential, incidental, or other damages whatsoever arising out of or related to your use or inability to use the Code, even if JMP has been advised of the possibility of such damages.  Except as otherwise provided above, the Code is governed by the same agreement that governs the Software.  If you do not have an existing agreement with JMP or SAS governing the Software, you may not use the Code.
JMP and all other JMP Statistical Discovery LLC product or service names are registered trademarks or trademarks of JMP Statistical Discovery LLC in the USA and other countries.  ® indicates USA registration.  Other brand and product names are registered trademarks or trademarks of their respective companies.
*/
Giardini
Level II

Re: Setting using JSL so that the control chart does not display batches for which there are missing data for a given parameter.

Thank You. I think your answer is close to what I want, and only a slight modification of the code would allow me to achieve the desired result. Unfortunately, I am at the beginning of my journey with the JMP SL, I would be grateful if you could help me obtain a code that would fully implement what I want to achieve.Therefore, I will try to explain my problem better. 

 

I need to say, that I use a loop to want control charts to be executed for different parameters from the data table. I'm having trouble with how, using your previous tip, I can change the code to take the i-th column as the one to filter on. I tried :Column(i), but I don't think that's the way...

 

I'm sharing a piece of code from my attempt to explain what I mean.

For( i = 2, i <= 5, i++,
	dt << Control Chart Builder(
		lstdates = Matrix( Associative Array( :Column( i ) ) << Get Keys );
		lstdates = As List( lstdates[Loc( !Is Missing( lstdates ) )] );
		Show Two Shewhart Charts( 0 );,
		Sort by Row Order( 1 ),
		Include Missing Categories( 0 ),
		Show Excluded Region( 0 ), //sprawdź które to które
		Show Limit Summaries( 0 ),
		Variables( Subgroup( :Batch ), Y( :Column( i ) ) ),
		Chart(
			Points( Statistic( "Individual" ) ),
			Limits( Sigma( "Levey Jennings" ) ),
			Warnings( Test 1( 1 ), Test 2( 1 ), Test 3( 1 ), Test 4( 1 ) )
		),
		ldf = cc << Local Data Filter(
			Add Filter( columns( :Column( i ) ), Where( :Column( i ) == lstdates ), Display( :Column( i ), N Items( 5 ) ) )
		),
		SendToReport(
			Dispatch( {}, "graph display 1 title", TextEditBox, {Set Text( "Levey Jennings chart of " || Nazwy[i] )} ),
			Dispatch( {}, "Subgroup display 1 title", TextEditBox, {Set Text( "Batch numer" )} )
			)
		);
	)
);

 

 

 

 

 

ih
Super User (Alumni) ih
Super User (Alumni)

Re: Setting using JSL so that the control chart does not display batches for which there are missing data for a given parameter.

I am a big fan of using transform columns right inside platforms.  Here is how I created the control chart part of the script below:

  1. Create the control chart using all data
  2. In the control panel, right click on Date and choose Formula
  3. Add Is Missing and Not functions so the formula is true when the column Date is not missing and close the dialog
  4. Right click on the new column and rename it to be 'HasDate'
  5. Right click on blue triangle next to the new column and change it to a Nominal data type
  6. Add a local data filter, the transformed column will automatically show up in the list of available columns

Here is what you should get:

ih_0-1701456714621.png

 

And here is the script to re-create it:

Names Default To Here (1);

dt = open ("$SAMPLE_DATA/Abrasion.jmp");

dt << Control Chart Builder(
	Transform Column( "HasDate", Nominal, Formula( !Is Missing( :Date ) ) ),
	Variables( Y( :Abrasion ) ),
	Show Control Panel( 0 ),
	Local Data Filter( Add Filter( columns( :HasDate ), Where( :HasDate == 1 ) ) )
);

If after you decide that is a helpful column creating a visual or doing an analysis , you can right click on it and add it to the data table.

Re: Setting using JSL so that the control chart does not display batches for which there are missing data for a given parameter.

Very nice, @ih !

Giardini
Level II

Re: Setting using JSL so that the control chart does not display batches for which there are missing data for a given parameter.

Don't you know maybe what should I write instead :Date, if I' m going to use loop "for" for every continous parameter in my data table?

Re: Setting using JSL so that the control chart does not display batches for which there are missing data for a given parameter.

This sample should show you how to get all the continuous columns into a list, then loop through those columns. Incidentally, if you are looking at multiple columns, have you considered either the Model Driven Multivariate Control Chart or the Process Screening Platform? Both of those excel at streamlining control charts for multiple outputs.

Names Default To Here( 1 );
//open sample data table
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

//get all numeric continuous colums, return list as strings
lstcols = dt << Get Column Names( Numeric, Continuous, String );

//run an analysis for each column in the list
For Each( {i}, lstcols,
	dt << Graph Builder(
		Show Control Panel( 0 ),
		Variables( X( :age ), Y( Column( i ) ) ), //Use each column
		Elements( Points( X, Y, Legend( 3 ) ) )
	)
);

/*JMP STATISTICAL DISCOVERY LLC (“JMP”) PERMITS THE USE OF THIS COMPUTER SOFTWARE CODE (“CODE”) ON AN AS-IS BASIS AND AUTHORIZES YOU TO USE THE CODE SUBJECT TO THE TERMS LISTED HEREIN.  BY USING THE CODE, YOU AGREE TO THESE TERMS.  YOUR USE OF THE CODE IS AT YOUR OWN RISK.  JMP MAKES NO REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRIGEMENT, AND TITLE, WITH RESPECT TO THE CODE.
You may use the Code solely as part of a software product you currently have licensed from JMP, JMP’s parent company SAS Institute Inc. (“SAS”), or one of JMP’s or SAS’s subsidiaries or authorized agents (the “Software”), and not for any other purpose.  The Code is designed to add functionality to the Software but has not necessarily been tested.  Accordingly, JMP makes no representation or warranty that the Code will operate error-free.  JMP is under no obligation to maintain, support, or continue to distribute the Code.
Neither JMP nor its licensors shall be liable to you or any third-party for any general, special, direct, indirect, consequential, incidental, or other damages whatsoever arising out of or related to your use or inability to use the Code, even if JMP has been advised of the possibility of such damages.  Except as otherwise provided above, the Code is governed by the same agreement that governs the Software.  If you do not have an existing agreement with JMP or SAS governing the Software, you may not use the Code.
JMP and all other JMP Statistical Discovery LLC product or service names are registered trademarks or trademarks of JMP Statistical Discovery LLC in the USA and other countries.  ® indicates USA registration.  Other brand and product names are registered trademarks or trademarks of their respective companies.
*/
Giardini
Level II

Re: Setting using JSL so that the control chart does not display batches for which there are missing data for a given parameter.

I think what I don't understand is why referring to a given column by its name (for example ':name') would work in my script but by 'column(i)' it doesn't (I know that in the code above I made a mistake by writing :column(i ), instead of column(i), but correcting it didn't change anything...)