<?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: Counting number of values or words in each column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Counting-number-of-values-or-words-in-each-column/m-p/723992#M90603</link>
    <description>&lt;P&gt;Remember that JMP is not Excel.&amp;nbsp; Every value in a column will follow the same format, so you can't have a running total at the bottom of your column.&amp;nbsp; For your situation, you could use table variables.&amp;nbsp; Try setting this as a table script:&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;= N Col( dt ), i++,
	dt &amp;lt;&amp;lt; Set Table Variable( (Column( dt, i ) &amp;lt;&amp;lt; Get Name) || "OK", N Items( dt &amp;lt;&amp;lt; Get Rows Where( Column( dt, i )[Row()] == "OK" ) ) )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It will have to be run to be up to date, of course, but it will keep your totals visible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mmarchandTSI_1-1707830481469.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/61081i3967CDA7190A168F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mmarchandTSI_1-1707830481469.png" alt="mmarchandTSI_1-1707830481469.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2024 13:21:39 GMT</pubDate>
    <dc:creator>mmarchandTSI</dc:creator>
    <dc:date>2024-02-13T13:21:39Z</dc:date>
    <item>
      <title>Counting number of values or words in each column</title>
      <link>https://community.jmp.com/t5/Discussions/Counting-number-of-values-or-words-in-each-column/m-p/723963#M90600</link>
      <description>&lt;P&gt;i have a data set and i want to count the number of "OK" and put the calculate value at the bottom of the row for each column.&lt;BR /&gt;&lt;BR /&gt;For example:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ab&lt;/TD&gt;&lt;TD&gt;ac&lt;/TD&gt;&lt;TD&gt;ad&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OH;OC;&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OH;OC;&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OH;OC;&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;TD&gt;OK&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;PRE&gt;For(i=1,i&amp;lt;=NCol(dt),i++,
Column(dt,i)[NRows(dt)] =  Char(N Rows( dt&amp;lt;&amp;lt; get rows where( As Column(dt,i) == "OK")));
)&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I was using the code above but it seems to not let me put the value in for a locked columns.&lt;BR /&gt;when i use try() it just ignores it and continues on the script.&lt;BR /&gt;The locked columns have formulas in them. is there another way to write this or over write locked column error , i am using jmp 14&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 12:19:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Counting-number-of-values-or-words-in-each-column/m-p/723963#M90600</guid>
      <dc:creator>jearls11</dc:creator>
      <dc:date>2024-02-13T12:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Counting number of values or words in each column</title>
      <link>https://community.jmp.com/t5/Discussions/Counting-number-of-values-or-words-in-each-column/m-p/723989#M90602</link>
      <description>&lt;P&gt;There is probably a more direct way to do this, but I think this will work.&amp;nbsp; Create a column of 0,1 values where 1 indicates it is OK.&amp;nbsp; Then use Table Summary to give the total number of 1s.&amp;nbsp; Make that into a data table and then concatenate (after making the column names match) with the original data table.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 13:12:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Counting-number-of-values-or-words-in-each-column/m-p/723989#M90602</guid>
      <dc:creator>dlehman1</dc:creator>
      <dc:date>2024-02-13T13:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Counting number of values or words in each column</title>
      <link>https://community.jmp.com/t5/Discussions/Counting-number-of-values-or-words-in-each-column/m-p/723992#M90603</link>
      <description>&lt;P&gt;Remember that JMP is not Excel.&amp;nbsp; Every value in a column will follow the same format, so you can't have a running total at the bottom of your column.&amp;nbsp; For your situation, you could use table variables.&amp;nbsp; Try setting this as a table script:&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;= N Col( dt ), i++,
	dt &amp;lt;&amp;lt; Set Table Variable( (Column( dt, i ) &amp;lt;&amp;lt; Get Name) || "OK", N Items( dt &amp;lt;&amp;lt; Get Rows Where( Column( dt, i )[Row()] == "OK" ) ) )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It will have to be run to be up to date, of course, but it will keep your totals visible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mmarchandTSI_1-1707830481469.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/61081i3967CDA7190A168F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mmarchandTSI_1-1707830481469.png" alt="mmarchandTSI_1-1707830481469.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 13:21:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Counting-number-of-values-or-words-in-each-column/m-p/723992#M90603</guid>
      <dc:creator>mmarchandTSI</dc:creator>
      <dc:date>2024-02-13T13:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: Counting number of values or words in each column</title>
      <link>https://community.jmp.com/t5/Discussions/Counting-number-of-values-or-words-in-each-column/m-p/723994#M90604</link>
      <description>&lt;P&gt;Since you are changing the structure of the data table with your addition of a summary value at the bottom of the table, the simplest way to avoid the issue with formula columns is to delete the formula for each column.&amp;nbsp; Formula deletion will not remove cell values, but will just make them static values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For(i=1,i&amp;lt;=NCol(dt),i++,
try(Column(dt,i)&amp;lt;&amp;lt;delete formula);
Column(dt,i)[NRows(dt)] =  Char(N Rows( dt&amp;lt;&amp;lt; get rows where( As Column(dt,i) == "OK")));
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The Try() function will just avoid any issue with attempting to delete a formula for columns that do not have a formula.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 13:34:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Counting-number-of-values-or-words-in-each-column/m-p/723994#M90604</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-02-13T13:34:04Z</dc:date>
    </item>
  </channel>
</rss>

