<?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: Iterate through multiple columns and replace cells in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Iterate-through-multiple-columns-and-replace-cells/m-p/40373#M23649</link>
    <description>&lt;P&gt;The main issues that I am seeing are that you did not identify the Hieght and Weight columns and that once you found the rows above or below 1 sigma, the values were not written back to the data table.&lt;/P&gt;
&lt;P&gt;Here is a modification to your code that corrects those issues.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
Clear Globals();

dt = Open("$SAMPLE_DATA\Big Class.jmp");

mycol = J( N Rows( dt ), 1 );
list_col_names = dt &amp;lt;&amp;lt; Get Column Names( String );

For( i = 4, i &amp;lt;= N Items( list_col_names ), i++, 
	cur_col = (list_col_names[i]);	
	If( Contains(cur_col,"ei") &amp;gt; 0, 	
		mycol = dt &amp;lt;&amp;lt; get as matrix( cur_col );			
		q25 = Quantile( 0.25, mycol );
		q50 = Quantile( 0.50, mycol );
		q75 = Quantile( 0.75, mycol );		
		mycol1 = ((mycol - q50) / ((q75 - q25) / 1.35));
		
		For( r = 1, r &amp;lt;= N Rows( dt ), r++,
			If(
				mycol1[r] &amp;gt; 1, column(dt,cur_col)[r] = .,
				mycol1[r] &amp;lt; -1, column(dt,cur_col)[r] = .
			));
				
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 13 Jun 2017 20:59:53 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2017-06-13T20:59:53Z</dc:date>
    <item>
      <title>Iterate through multiple columns and replace cells</title>
      <link>https://community.jmp.com/t5/Discussions/Iterate-through-multiple-columns-and-replace-cells/m-p/40367#M23646</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to iterate through multiple tables and replace any value &amp;gt;6 sigma with a ".". Below is my attempt to iterate through big class and replace the weight and height values greater than 1 sigma with a .; however, it is not working as intended. I think I'm confusing myself with the two strings.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
Clear Globals();



dt = Open("...\SAS\JMP\13\Samples\Data\Big Class.jmp");


mycol = J( N Rows( dt ), 1 );
list_col_names = dt &amp;lt;&amp;lt; Get Column Names( String );


For( i = 1, i &amp;lt;= N Items( list_col_names ), i++, 

	cur_col = (list_col_names[i]);
	
	
	If( Left( cur_col,1 ) == "ei", 
	
		mycol = dt &amp;lt;&amp;lt; get as matrix( cur_col );
			
		q25 = Quantile( 0.25, mycol );
		q50 = Quantile( 0.50, mycol );
		q75 = Quantile( 0.75, mycol );
		
		mycol1 = ((mycol - q50) / ((q75 - q25) / 1.35));
		
		For( r = 1, r &amp;lt;= N Rows( dt ), r++,
			If(
				mycol1[r] &amp;gt; 1, mycol1[r] = .,
				mycol1[r] &amp;lt; -1, mycol1[r] = .
			));
		
	);
);



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 20:16:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Iterate-through-multiple-columns-and-replace-cells/m-p/40367#M23646</guid>
      <dc:creator>Ksrzg01</dc:creator>
      <dc:date>2017-06-13T20:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through multiple columns and replace cells</title>
      <link>https://community.jmp.com/t5/Discussions/Iterate-through-multiple-columns-and-replace-cells/m-p/40373#M23649</link>
      <description>&lt;P&gt;The main issues that I am seeing are that you did not identify the Hieght and Weight columns and that once you found the rows above or below 1 sigma, the values were not written back to the data table.&lt;/P&gt;
&lt;P&gt;Here is a modification to your code that corrects those issues.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
Clear Globals();

dt = Open("$SAMPLE_DATA\Big Class.jmp");

mycol = J( N Rows( dt ), 1 );
list_col_names = dt &amp;lt;&amp;lt; Get Column Names( String );

For( i = 4, i &amp;lt;= N Items( list_col_names ), i++, 
	cur_col = (list_col_names[i]);	
	If( Contains(cur_col,"ei") &amp;gt; 0, 	
		mycol = dt &amp;lt;&amp;lt; get as matrix( cur_col );			
		q25 = Quantile( 0.25, mycol );
		q50 = Quantile( 0.50, mycol );
		q75 = Quantile( 0.75, mycol );		
		mycol1 = ((mycol - q50) / ((q75 - q25) / 1.35));
		
		For( r = 1, r &amp;lt;= N Rows( dt ), r++,
			If(
				mycol1[r] &amp;gt; 1, column(dt,cur_col)[r] = .,
				mycol1[r] &amp;lt; -1, column(dt,cur_col)[r] = .
			));
				
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jun 2017 20:59:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Iterate-through-multiple-columns-and-replace-cells/m-p/40373#M23649</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-06-13T20:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through multiple columns and replace cells</title>
      <link>https://community.jmp.com/t5/Discussions/Iterate-through-multiple-columns-and-replace-cells/m-p/40374#M23650</link>
      <description>&lt;P&gt;Thats where my issue was, it works great! Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 21:06:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Iterate-through-multiple-columns-and-replace-cells/m-p/40374#M23650</guid>
      <dc:creator>Ksrzg01</dc:creator>
      <dc:date>2017-06-13T21:06:04Z</dc:date>
    </item>
  </channel>
</rss>

