cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMPĀ® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
qspringleaf
Level III

how to use JSL "select where" function to select data and subset

can help to suggest how to use JSL "select where" function to select data and subset?

for example, I want to select cell match (XY018, XY023, XY033, XY038, XY039, XY050), it may from different lot (lot column may have more than 10 different groups, so how to use JSL  use required criteria above to select "SITE" column and subset the data, thanks a lot.

 

LOTSITEData
LL01XY0010.546728
LL01XY0020.055965
LL01XY0030.303851
LL01XY0040.858696
LL01XY0050.089441
LL01XY0060.6769
LL01XY0070.764777
LL01XY0080.232966
LL01XY0090.464361
LL01XY0100.647894
LL01XY0110.197118
LL01XY0120.824098
LL01XY0130.288582
LL01XY0140.758274
LL01XY0150.360068
LL01XY0160.996029
LL01XY0170.557039
LL01XY0180.579821
LL01XY0190.84759
LL01XY0200.5814
LL01XY0210.249923
LL01XY0220.126439
LL01XY0230.815976
LL01XY0240.340023
LL01XY0250.228621
LL01XY0260.356278
LL01XY0270.815186
LL01XY0280.483265
LL01XY0290.950447
LL01XY0300.397944
LL01XY0310.179747
LL01XY0320.892906
LL01XY0330.831573
LL01XY0340.207603
LL01XY0350.644884
LL01XY0360.557065
LL01XY0370.00514
LL01XY0380.692865
LL01XY0390.793528
LL01XY0400.545025
LL01XY0410.908561
LL01XY0420.020471
LL01XY0430.656038
LL01XY0440.785081
LL01XY0450.426485
LL01XY0460.331112
LL01XY0470.158288
LL01XY0480.025213
LL01XY0490.262702
LL01XY0500.373579
LL01XY0510.440254
XY02XY0010.163887
XY02XY0020.371756
XY02XY0030.403243
XY02XY0040.003273
XY02XY0050.487236
XY02XY0060.137888
XY02XY0070.29748
XY02XY0080.955243
XY02XY0090.012711
XY02XY0100.576878
XY02XY0110.944287
XY02XY0120.776797
XY02XY0130.158493
XY02XY0140.598779
XY02XY0150.714543
XY02XY0160.29589
XY02XY0170.969492
XY02XY0180.086959
XY02XY0190.046462
XY02XY0200.037904
XY02XY0210.360544
XY02XY0220.534296
XY02XY0230.35869
XY02XY0240.380169
XY02XY0250.17056
XY02XY0260.012633
XY02XY0270.59057
XY02XY0280.716395
XY02XY0290.136862
XY02XY0300.849967
XY02XY0310.17172
XY02XY0320.870706
XY02XY0330.415646
XY02XY0340.434663
XY02XY0350.588884
XY02XY0360.845628
XY02XY0370.831929
XY02XY0380.149653
XY02XY0390.222923
XY02XY0400.383863
XY02XY0410.965367
XY02XY0420.019468
XY02XY0430.968852
XY02XY0440.418934
XY02XY0450.122715
XY02XY0460.705794
XY02XY0470.882526
XY02XY0480.836149
XY02XY0490.330755
XY02XY0500.21195
XY02XY0510.474435
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: how to use JSL "select where" function to select data and subset

I strongly suggest checking out JMP Scripting Index, JMP help https://www.jmp.com/support/help/en/15.2/index.shtml#page/jmp/select-rows-2.shtml# and JMP Scripting Guide https://www.jmp.com/content/dam/jmp/documents/en/support/jmp151/scripting-guide.pdf 

 

You could first check out how JMP would do it from Select Where menu:

jthi_0-1611514795216.png

 

Fill out dialog:

jthi_1-1611514806601.png

 

And from red triangle you can copy the code:

jthi_2-1611514820944.png

 

Script:

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(102),
	Compress File When Saved(1),
	New Script(
		"Subset Script",
		Data Table("Untitled") << Subset(
			Selected Rows(0),
			Rows([18, 23, 33, 38, 39, 50, 69, 74, 84, 89, 90, 101]),
			Selected columns only(0)
		)
	),
	New Column("LOT",
		Character,
		"Nominal",
		Set Values(
			{"LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01",
			"LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01",
			"LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01",
			"LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01",
			"LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01",
			"LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "XY02", "XY02", "XY02",
			"XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02",
			"XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02",
			"XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02",
			"XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02",
			"XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02",
			"XY02", "XY02", "XY02"}
		)
	),
	New Column("SITE",
		Character(16),
		"Nominal",
		Set Values(
			{"XY001", "XY002", "XY003", "XY004", "XY005", "XY006", "XY007", "XY008",
			"XY009", "XY010", "XY011", "XY012", "XY013", "XY014", "XY015", "XY016",
			"XY017", "XY018", "XY019", "XY020", "XY021", "XY022", "XY023", "XY024",
			"XY025", "XY026", "XY027", "XY028", "XY029", "XY030", "XY031", "XY032",
			"XY033", "XY034", "XY035", "XY036", "XY037", "XY038", "XY039", "XY040",
			"XY041", "XY042", "XY043", "XY044", "XY045", "XY046", "XY047", "XY048",
			"XY049", "XY050", "XY051", "XY001", "XY002", "XY003", "XY004", "XY005",
			"XY006", "XY007", "XY008", "XY009", "XY010", "XY011", "XY012", "XY013",
			"XY014", "XY015", "XY016", "XY017", "XY018", "XY019", "XY020", "XY021",
			"XY022", "XY023", "XY024", "XY025", "XY026", "XY027", "XY028", "XY029",
			"XY030", "XY031", "XY032", "XY033", "XY034", "XY035", "XY036", "XY037",
			"XY038", "XY039", "XY040", "XY041", "XY042", "XY043", "XY044", "XY045",
			"XY046", "XY047", "XY048", "XY049", "XY050", "XY051"}
		)
	),
	New Column("Data",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values(
			[0.546728, 0.055965, 0.303851, 0.858696, 0.089441, 0.6769, 0.764777,
			0.232966, 0.464361, 0.647894, 0.197118, 0.824098, 0.288582, 0.758274,
			0.360068, 0.996029, 0.557039, 0.579821, 0.84759, 0.5814, 0.249923,
			0.126439, 0.815976, 0.340023, 0.228621, 0.356278, 0.815186, 0.483265,
			0.950447, 0.397944, 0.179747, 0.892906, 0.831573, 0.207603, 0.644884,
			0.557065, 0.00514, 0.692865, 0.793528, 0.545025, 0.908561, 0.020471,
			0.656038, 0.785081, 0.426485, 0.331112, 0.158288, 0.025213, 0.262702,
			0.373579, 0.440254, 0.163887, 0.371756, 0.403243, 0.003273, 0.487236,
			0.137888, 0.29748, 0.955243, 0.012711, 0.576878, 0.944287, 0.776797,
			0.158493, 0.598779, 0.714543, 0.29589, 0.969492, 0.086959, 0.046462,
			0.037904, 0.360544, 0.534296, 0.35869, 0.380169, 0.17056, 0.012633,
			0.59057, 0.716395, 0.136862, 0.849967, 0.17172, 0.870706, 0.415646,
			0.434663, 0.588884, 0.845628, 0.831929, 0.149653, 0.222923, 0.383863,
			0.965367, 0.019468, 0.968852, 0.418934, 0.122715, 0.705794, 0.882526,
			0.836149, 0.330755, 0.21195, 0.474435]
		)
	)
);

/*
//Select where solution from JMP:
dt << Row Selection(
	Select where(
		:SITE == "XY018" | :SITE == "XY023" | :SITE == "XY033" | :SITE == "XY038" |
		:SITE == "XY039" | :SITE == "XY050"
	)
);
*/

//easier to maintein solution with list
sitelist = {"XY018", "XY023", "XY033", "XY038", "XY039", "XY050"};
dt << Select Where(ContainsItem(:SITE, sitelist));

//subset
dt << Subset(Outputtable("newtable"), Selected Rows, Selected columns only(0));
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: how to use JSL "select where" function to select data and subset

I strongly suggest checking out JMP Scripting Index, JMP help https://www.jmp.com/support/help/en/15.2/index.shtml#page/jmp/select-rows-2.shtml# and JMP Scripting Guide https://www.jmp.com/content/dam/jmp/documents/en/support/jmp151/scripting-guide.pdf 

 

You could first check out how JMP would do it from Select Where menu:

jthi_0-1611514795216.png

 

Fill out dialog:

jthi_1-1611514806601.png

 

And from red triangle you can copy the code:

jthi_2-1611514820944.png

 

Script:

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(102),
	Compress File When Saved(1),
	New Script(
		"Subset Script",
		Data Table("Untitled") << Subset(
			Selected Rows(0),
			Rows([18, 23, 33, 38, 39, 50, 69, 74, 84, 89, 90, 101]),
			Selected columns only(0)
		)
	),
	New Column("LOT",
		Character,
		"Nominal",
		Set Values(
			{"LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01",
			"LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01",
			"LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01",
			"LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01",
			"LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "LL01",
			"LL01", "LL01", "LL01", "LL01", "LL01", "LL01", "XY02", "XY02", "XY02",
			"XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02",
			"XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02",
			"XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02",
			"XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02",
			"XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02", "XY02",
			"XY02", "XY02", "XY02"}
		)
	),
	New Column("SITE",
		Character(16),
		"Nominal",
		Set Values(
			{"XY001", "XY002", "XY003", "XY004", "XY005", "XY006", "XY007", "XY008",
			"XY009", "XY010", "XY011", "XY012", "XY013", "XY014", "XY015", "XY016",
			"XY017", "XY018", "XY019", "XY020", "XY021", "XY022", "XY023", "XY024",
			"XY025", "XY026", "XY027", "XY028", "XY029", "XY030", "XY031", "XY032",
			"XY033", "XY034", "XY035", "XY036", "XY037", "XY038", "XY039", "XY040",
			"XY041", "XY042", "XY043", "XY044", "XY045", "XY046", "XY047", "XY048",
			"XY049", "XY050", "XY051", "XY001", "XY002", "XY003", "XY004", "XY005",
			"XY006", "XY007", "XY008", "XY009", "XY010", "XY011", "XY012", "XY013",
			"XY014", "XY015", "XY016", "XY017", "XY018", "XY019", "XY020", "XY021",
			"XY022", "XY023", "XY024", "XY025", "XY026", "XY027", "XY028", "XY029",
			"XY030", "XY031", "XY032", "XY033", "XY034", "XY035", "XY036", "XY037",
			"XY038", "XY039", "XY040", "XY041", "XY042", "XY043", "XY044", "XY045",
			"XY046", "XY047", "XY048", "XY049", "XY050", "XY051"}
		)
	),
	New Column("Data",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values(
			[0.546728, 0.055965, 0.303851, 0.858696, 0.089441, 0.6769, 0.764777,
			0.232966, 0.464361, 0.647894, 0.197118, 0.824098, 0.288582, 0.758274,
			0.360068, 0.996029, 0.557039, 0.579821, 0.84759, 0.5814, 0.249923,
			0.126439, 0.815976, 0.340023, 0.228621, 0.356278, 0.815186, 0.483265,
			0.950447, 0.397944, 0.179747, 0.892906, 0.831573, 0.207603, 0.644884,
			0.557065, 0.00514, 0.692865, 0.793528, 0.545025, 0.908561, 0.020471,
			0.656038, 0.785081, 0.426485, 0.331112, 0.158288, 0.025213, 0.262702,
			0.373579, 0.440254, 0.163887, 0.371756, 0.403243, 0.003273, 0.487236,
			0.137888, 0.29748, 0.955243, 0.012711, 0.576878, 0.944287, 0.776797,
			0.158493, 0.598779, 0.714543, 0.29589, 0.969492, 0.086959, 0.046462,
			0.037904, 0.360544, 0.534296, 0.35869, 0.380169, 0.17056, 0.012633,
			0.59057, 0.716395, 0.136862, 0.849967, 0.17172, 0.870706, 0.415646,
			0.434663, 0.588884, 0.845628, 0.831929, 0.149653, 0.222923, 0.383863,
			0.965367, 0.019468, 0.968852, 0.418934, 0.122715, 0.705794, 0.882526,
			0.836149, 0.330755, 0.21195, 0.474435]
		)
	)
);

/*
//Select where solution from JMP:
dt << Row Selection(
	Select where(
		:SITE == "XY018" | :SITE == "XY023" | :SITE == "XY033" | :SITE == "XY038" |
		:SITE == "XY039" | :SITE == "XY050"
	)
);
*/

//easier to maintein solution with list
sitelist = {"XY018", "XY023", "XY033", "XY038", "XY039", "XY050"};
dt << Select Where(ContainsItem(:SITE, sitelist));

//subset
dt << Subset(Outputtable("newtable"), Selected Rows, Selected columns only(0));
-Jarmo