<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Deleting cell values in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Deleting-cell-values/m-p/46961#M26763</link>
    <description>&lt;P&gt;You are approaching the problem correctly, you just have some syntax issues.&amp;nbsp; Below is a working version of your code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

// Select the columns to be evaluated
// ColList = {"x_1","x_2","x_3","x_4","x_5","x_6"};
// or if there is a programmatic way to get the list,
// do something like below
ColList = dt &amp;lt;&amp;lt; get column names( numeric, string );
// Loop backwards through the list so the "i" index
// maintains it's proper reference
For( i = N Items( ColList ), i &amp;gt;= 1, i--,
	If( Left( ColList[i], 2 ) != "x_",
		ColList = Remove( ColList, i, 1 )
	)
);

// Loop across ColList and set the values qualified
// values to missing
For( i = 1, i &amp;lt;= N Items( ColList ), i++,
	// The line below takes advantage of a JMP feature where
	// you can change specific values in a column in one statement
	// by just using a matrix of the rows you want to change
	//    Column A[5,6,9,22] = 4;
	// This would set a column named "Column A"'s rows 5,6,9 and 22
	// to the value of 4
	// In your case, you want to eliminate the cell value, so the 
	// line sets the value to a missing value, which in JMP is "."
	Column( dt, ColList[i] )[dt &amp;lt;&amp;lt; get rows where( As Column( dt, ColList[i] ) == 8 )] = .;
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
    <pubDate>Fri, 31 Jan 2020 15:06:43 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2020-01-31T15:06:43Z</dc:date>
    <item>
      <title>Deleting cell values</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-cell-values/m-p/46957#M26760</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have&amp;nbsp;a similar table as shown below:&lt;/P&gt;
&lt;P&gt;1. Table has numeric columns x_1, x_2, x3, ...&lt;/P&gt;
&lt;P&gt;2. I want to delete a specific value, for example 8, from all the rows of cols x_1, x_2, x_3, ... . (Required o/p table shown below as well.)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Input table&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;x_1&lt;/TD&gt;
&lt;TD&gt;x_2&lt;/TD&gt;
&lt;TD&gt;x_3&lt;/TD&gt;
&lt;TD&gt;x_4&lt;/TD&gt;
&lt;TD&gt;x_5&lt;/TD&gt;
&lt;TD&gt;x_6&lt;/TD&gt;
&lt;TD&gt;E&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;8&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;7&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt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;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My script is attached...&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thanks in advance for the help/feedback :)&lt;/img&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table ();
for (i=1, i&amp;lt;=6, i++, //iterate through columns loop
temp = "x_" || char (i); //column name
dt &amp;lt;&amp;lt; Go To (temp); //select column
dt &amp;lt;&amp;lt; Select Where (temp==8);// Select rows where value is 8 ***PROBLEM*** Not selecting rows :(
//After selecting rows where value is 8 for a specific column, I want to delect the value...May be use Empty() ??
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Jan 2020 15:04:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-cell-values/m-p/46957#M26760</guid>
      <dc:creator>aumair</dc:creator>
      <dc:date>2020-01-31T15:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting cell values</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-cell-values/m-p/46961#M26763</link>
      <description>&lt;P&gt;You are approaching the problem correctly, you just have some syntax issues.&amp;nbsp; Below is a working version of your code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

// Select the columns to be evaluated
// ColList = {"x_1","x_2","x_3","x_4","x_5","x_6"};
// or if there is a programmatic way to get the list,
// do something like below
ColList = dt &amp;lt;&amp;lt; get column names( numeric, string );
// Loop backwards through the list so the "i" index
// maintains it's proper reference
For( i = N Items( ColList ), i &amp;gt;= 1, i--,
	If( Left( ColList[i], 2 ) != "x_",
		ColList = Remove( ColList, i, 1 )
	)
);

// Loop across ColList and set the values qualified
// values to missing
For( i = 1, i &amp;lt;= N Items( ColList ), i++,
	// The line below takes advantage of a JMP feature where
	// you can change specific values in a column in one statement
	// by just using a matrix of the rows you want to change
	//    Column A[5,6,9,22] = 4;
	// This would set a column named "Column A"'s rows 5,6,9 and 22
	// to the value of 4
	// In your case, you want to eliminate the cell value, so the 
	// line sets the value to a missing value, which in JMP is "."
	Column( dt, ColList[i] )[dt &amp;lt;&amp;lt; get rows where( As Column( dt, ColList[i] ) == 8 )] = .;
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2020 15:06:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-cell-values/m-p/46961#M26763</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-01-31T15:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting cell values</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-cell-values/m-p/46980#M26776</link>
      <description>&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;I was thinking of using a loop to access rows iterativelyand then change it, but this is very nice way to use JSL :)&lt;/img&gt;&lt;/P&gt;&lt;PRE class=" language-jsl"&gt;&lt;CODE class="  language-jsl"&gt;&lt;SPAN class="token function"&gt;Column&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt; dt&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; ColList&lt;SPAN class="token punctuation"&gt;[&lt;/SPAN&gt;i&lt;SPAN class="token punctuation"&gt;]&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;[&lt;/SPAN&gt;dt &lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt; get rows where&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;As Column&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt; dt&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; ColList&lt;SPAN class="token punctuation"&gt;[&lt;/SPAN&gt;i&lt;SPAN class="token punctuation"&gt;]&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;==&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;8&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;]&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 17:51:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-cell-values/m-p/46980#M26776</guid>
      <dc:creator>aumair</dc:creator>
      <dc:date>2017-11-09T17:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting cell values</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-cell-values/m-p/244492#M48166</link>
      <description>&lt;P&gt;Data table subscripting is also an option, in case it is faster for your situation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = open("$SAMPLE_DATA/Big Class.jmp");
r = loc(dt[0, 4]==61)
dt[r, 4] = .;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Jan 2020 15:00:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-cell-values/m-p/244492#M48166</guid>
      <dc:creator>XanGregg</dc:creator>
      <dc:date>2020-01-31T15:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting cell values</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-cell-values/m-p/259919#M51020</link>
      <description>&lt;P&gt;Interesting.&amp;nbsp; I have a slightly different need for something like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say I have 2 columns A and B.&amp;nbsp; A is supposed to have date/time and B has a key value.&amp;nbsp; I have lines where the Date/time is missing but column B has a key.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I delete the key value when the date/time is missing.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 22:09:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-cell-values/m-p/259919#M51020</guid>
      <dc:creator>UberBock</dc:creator>
      <dc:date>2020-04-22T22:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting cell values</title>
      <link>https://community.jmp.com/t5/Discussions/Deleting-cell-values/m-p/259935#M51025</link>
      <description>&lt;P&gt;Here is a very small change to the previous script that will do what you want&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
// set some height rows to missing
dt:height[6] = .;
dt:height[14] = .;


r = loc(ismissing(dt[0, 4]));
// set the values in column 5(wieght) to missing
// for the rows found(located) in column 4
dt[r, 5] = .;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Apr 2020 00:26:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Deleting-cell-values/m-p/259935#M51025</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-04-23T00:26:29Z</dc:date>
    </item>
  </channel>
</rss>

