<?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: Using a FOR loop in Formula to create a new column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Using-a-FOR-loop-in-Formula-to-create-a-new-column/m-p/17684#M16115</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks Jim. since i don't know the number of columns, I'll try to put your equation into an expr() using a for loop, and then move this to the if statement with an eval( ) of the expression generated in the for loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Mar 2016 22:21:45 GMT</pubDate>
    <dc:creator>jetpeach</dc:creator>
    <dc:date>2016-03-30T22:21:45Z</dc:date>
    <item>
      <title>Using a FOR loop in Formula to create a new column</title>
      <link>https://community.jmp.com/t5/Discussions/Using-a-FOR-loop-in-Formula-to-create-a-new-column/m-p/17682#M16113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi folks, I have a question regarding how I can combine a number of columns created in my table, into a new column that describes whether any of these columns have a specific char value ("screened").&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently my datasets are analyzed with a script that adds "n" new columns that contain the char values "screened" and "unscreened" based on formulas in the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My goal is to include in the script a final step that adds a new column that evaluates the value in each of the 'n' new columns and if for each row, any of those columns are 'screened' then it labels that row as screened.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the number of new columns was always the same, I would just write a long-ish If statement, checking the value in each column. However, I need to script it to look at 'n' number of columns. I thought to use a FOR loop inside of a forumula, e.g.,&amp;nbsp; something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; New Column("All_screens",character,nominal,setformula(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; If( For( i = 1, i &amp;lt;= N Items( &lt;SPAN style="font-size: 13.3333px;"&gt;individualScreenColumns&lt;/SPAN&gt; ), individualScreenColumns&lt;I&gt; == "Screened"),&amp;nbsp;&amp;nbsp; ---&amp;gt; need some magic such that if any of the screening columns contain screen, then ---&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Screened", "Unscreened"&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;)&lt;/SPAN&gt;);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But since FOR loops don't return any value, I couldn't figure this magic out. Does anyone have any thoughts?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;--Peach&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2016 20:37:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-a-FOR-loop-in-Formula-to-create-a-new-column/m-p/17682#M16113</guid>
      <dc:creator>jetpeach</dc:creator>
      <dc:date>2016-03-30T20:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using a FOR loop in Formula to create a new column</title>
      <link>https://community.jmp.com/t5/Discussions/Using-a-FOR-loop-in-Formula-to-create-a-new-column/m-p/17683#M16114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I use a boulian summation to solve the issue you are talking about.&amp;nbsp; If you have 4 columns, a,b,c,d, I have used a formula of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If(sum(a=="screened",b=="screened",c=="screened",d=="screened")&amp;gt;0, "screened","")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2016 22:03:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-a-FOR-loop-in-Formula-to-create-a-new-column/m-p/17683#M16114</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2016-03-30T22:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using a FOR loop in Formula to create a new column</title>
      <link>https://community.jmp.com/t5/Discussions/Using-a-FOR-loop-in-Formula-to-create-a-new-column/m-p/17684#M16115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks Jim. since i don't know the number of columns, I'll try to put your equation into an expr() using a for loop, and then move this to the if statement with an eval( ) of the expression generated in the for loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2016 22:21:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-a-FOR-loop-in-Formula-to-create-a-new-column/m-p/17684#M16115</guid>
      <dc:creator>jetpeach</dc:creator>
      <dc:date>2016-03-30T22:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using a FOR loop in Formula to create a new column</title>
      <link>https://community.jmp.com/t5/Discussions/Using-a-FOR-loop-in-Formula-to-create-a-new-column/m-p/17685#M16116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The implementation of row-wise operations across an unknown number of columns in column formulas is not very straightforward (however magic is not required). &lt;/P&gt;&lt;P&gt;Below are some ideas taking advantage of local variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; color: #008f00;"&gt;// Just an example table&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;n &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;5&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;nr &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;;however&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;dt &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #032ce4;"&gt;New Table&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;SPAN style="color: #942193;"&gt;"Screening summary"&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; Add Rows&lt;STRONG&gt;(&lt;/STRONG&gt;nr&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; Add Multiple Columns&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;SPAN style="color: #942193;"&gt;"X"&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; n&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; character&lt;STRONG&gt;))&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&lt;SPAN style="color: #032ce4;"&gt;For&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;i &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; i &lt;SPAN style="color: #011993;"&gt;&amp;lt;=&lt;/SPAN&gt; n&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; i&lt;SPAN style="color: #011993;"&gt;++,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #032ce4;"&gt;Column&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;dt&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; i&lt;STRONG&gt;)&lt;/STRONG&gt; &lt;SPAN style="color: #011993;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;Set Each Value&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;({&lt;/STRONG&gt;&lt;SPAN style="color: #942193;"&gt;"screened"&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #942193;"&gt;"unscreened"&lt;/SPAN&gt;&lt;STRONG&gt;}[&lt;/STRONG&gt;&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #011993;"&gt;+&lt;/SPAN&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;&lt;SPAN style="color: #032ce4;"&gt;Random Integer&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; nr&lt;STRONG&gt;)&lt;/STRONG&gt; &lt;SPAN style="color: #011993;"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;)])&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; min-height: 13px;"&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; color: #008f00;"&gt;// New column indicating if any column contains "screened"&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; min-height: 13px;"&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; color: #011993;"&gt;&lt;SPAN style="color: #000000;"&gt;dt &lt;/SPAN&gt;&amp;lt;&amp;lt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;New Column&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #942193;"&gt;"Screened"&lt;/SPAN&gt;,&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Character&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Formula&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; color: #032ce4;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Local&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;({&lt;/STRONG&gt;i &lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; n &lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;N Col&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;Current Data Table&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;())&lt;/STRONG&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;-&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #032ce4;"&gt;If&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;SPAN style="color: #032ce4;"&gt;Contains&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;SPAN style="color: #032ce4;"&gt;Repeat&lt;/SPAN&gt;&lt;STRONG&gt;({&lt;/STRONG&gt;i&lt;SPAN style="color: #011993;"&gt;++&lt;/SPAN&gt; &lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt; &lt;SPAN style="color: #032ce4;"&gt;Column&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;i&lt;STRONG&gt;)[]}&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; n&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #942193;"&gt;"screened"&lt;/SPAN&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #942193;"&gt;"screened"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; min-height: 13px;"&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; color: #008f00;"&gt;// The same but with a For() loop; less neat code but probably more efficient than Repeat() for large n&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; color: #008f00;"&gt;// because no intermediate lists are built&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; color: #011993;"&gt;&lt;SPAN style="color: #000000;"&gt;dt &lt;/SPAN&gt;&amp;lt;&amp;lt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;New Column&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #942193;"&gt;"Screened 2"&lt;/SPAN&gt;,&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Character&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Formula&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; color: #032ce4;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Local&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;({&lt;/STRONG&gt;i&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; n &lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;N Col&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;Current Data Table&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;())&lt;/STRONG&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;-&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; s &lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #942193;"&gt;""&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #032ce4;"&gt;For&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;i &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; i &lt;SPAN style="color: #011993;"&gt;&amp;lt;=&lt;/SPAN&gt; n&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; i&lt;SPAN style="color: #011993;"&gt;++,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #032ce4;"&gt;If&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;SPAN style="color: #032ce4;"&gt;Column&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;i&lt;STRONG&gt;)[]&lt;/STRONG&gt; &lt;SPAN style="color: #011993;"&gt;==&lt;/SPAN&gt; &lt;SPAN style="color: #942193;"&gt;"screened"&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #942193;"&gt;"screened"&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #032ce4;"&gt;Break&lt;/SPAN&gt;&lt;STRONG&gt;()&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; min-height: 13px;"&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; color: #008f00;"&gt;// Alternatively, return nr of "screened"&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; color: #942193;"&gt;&lt;SPAN style="color: #000000;"&gt;dt &lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;New Column&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;" Nr of Screened"&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Numeric&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Formula&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;SPAN style="color: #032ce4;"&gt;Local&lt;/SPAN&gt;&lt;STRONG&gt;({&lt;/STRONG&gt;i &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; n &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #032ce4;"&gt;N Col&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;SPAN style="color: #032ce4;"&gt;Current Data Table&lt;/SPAN&gt;&lt;STRONG&gt;())&lt;/STRONG&gt; &lt;SPAN style="color: #011993;"&gt;-&lt;/SPAN&gt; &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #032ce4;"&gt;Sum&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;SPAN style="color: #032ce4;"&gt;Repeat&lt;/SPAN&gt;&lt;STRONG&gt;({&lt;/STRONG&gt;i&lt;SPAN style="color: #011993;"&gt;++&lt;/SPAN&gt; &lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt; &lt;SPAN style="color: #032ce4;"&gt;Column&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;i&lt;STRONG&gt;)[]&lt;/STRONG&gt; &lt;SPAN style="color: #011993;"&gt;==&lt;/SPAN&gt; &lt;SPAN style="color: #942193;"&gt;"screened"&lt;/SPAN&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; n&lt;STRONG&gt;))))&lt;/STRONG&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2016 22:58:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-a-FOR-loop-in-Formula-to-create-a-new-column/m-p/17685#M16116</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2016-03-30T22:58:02Z</dc:date>
    </item>
  </channel>
</rss>

