<?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: is there an easy way of creating count variable in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243409#M48036</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/958"&gt;@ron_horne&lt;/a&gt;&amp;nbsp;Thanks for quick reply. I used this formula&amp;nbsp;&lt;SPAN&gt;Sum( :ID[Index( 1, Row() )] == :ID ) but I did not get the results. Data table is attached where I used formula.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jan 2020 01:19:25 GMT</pubDate>
    <dc:creator>billi</dc:creator>
    <dc:date>2020-01-29T01:19:25Z</dc:date>
    <item>
      <title>is there an easy way of creating count variable</title>
      <link>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243398#M48034</link>
      <description>&lt;P&gt;I want to create new count variable using variables ID and use_yn (data attached). If variable use_yn for specific ID it represent subject used the service (eg. subject 3 used service twice because it has value 1 twice). Can this be done without JSL?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 23:25:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243398#M48034</guid>
      <dc:creator>billi</dc:creator>
      <dc:date>2020-01-28T23:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: is there an easy way of creating count variable</title>
      <link>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243408#M48035</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14229"&gt;@billi&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;have a look at this discussion. it has a few options &lt;BR /&gt;&lt;A href="https://community.jmp.com/t5/Discussions/Syntax-How-do-I-create-an-index-column-by-ID/m-p/9751/highlight/true#M9537" target="_blank"&gt;https://community.jmp.com/t5/Discussions/Syntax-How-do-I-create-an-index-column-by-ID/m-p/9751/highlight/true#M9537&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;let us know if it works&lt;/P&gt;
&lt;P&gt;ron&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 23:32:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243408#M48035</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2020-01-28T23:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: is there an easy way of creating count variable</title>
      <link>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243409#M48036</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/958"&gt;@ron_horne&lt;/a&gt;&amp;nbsp;Thanks for quick reply. I used this formula&amp;nbsp;&lt;SPAN&gt;Sum( :ID[Index( 1, Row() )] == :ID ) but I did not get the results. Data table is attached where I used formula.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 01:19:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243409#M48036</guid>
      <dc:creator>billi</dc:creator>
      <dc:date>2020-01-29T01:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: is there an easy way of creating count variable</title>
      <link>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243410#M48037</link>
      <description>&lt;P&gt;There are several useful techniques in the link that Ron provided, but you would need to do some modifications.&lt;/P&gt;
&lt;P&gt;Here is a column formula (stored in a column called "New Count") that I created that does the count. Note that the formula calls itself.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(
	Row() == 1, :use_yn[1],
	:ID[Row()] == :ID[Row() - 1], :New Count[Row() - 1] + :use_yn[Row()],
	:ID[Row()] != :ID[Row() - 1], :use_yn[Row()],
	0
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have enclosed the data table, too. Note that if you have a missing value in "use_yn", the "New Count" will go missing. This makes sense because if you do not know if someone "used yn", then you won't know the count either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 16:34:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243410#M48037</guid>
      <dc:creator>Dan_Obermiller</dc:creator>
      <dc:date>2020-01-29T16:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: is there an easy way of creating count variable</title>
      <link>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243411#M48038</link>
      <description>&lt;P&gt;The Summary Platform gets you what you want.&amp;nbsp; Then some simple manipulations and an update and you have your answer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Tables==&amp;gt;Summary&lt;/P&gt;
&lt;P&gt;Select both ID and use_yn as your grouping variables.&lt;/P&gt;
&lt;P&gt;Make sure to unselect "Link to Original Data Table: and then click on OK.&lt;/P&gt;
&lt;P&gt;The new data table has all combinations of ID and use_yn, and you only want where use_yn = 1, so, click on one cell that has use_yn with the value of 1.&amp;nbsp; Then right click and select&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Select Matching Cells&lt;/P&gt;
&lt;P&gt;All rows with use_yn are selected.....but what you want are the opposite selection, so you can delete them.&lt;/P&gt;
&lt;P&gt;Move the cursor to one of the selected rows, and then into the RowState column for that row.&amp;nbsp; Right click and select Invert selection.&amp;nbsp; Now just go to one of the newly selected rows, and right click and select Delete Rows.&amp;nbsp; You now have the counts that you requested.&lt;/P&gt;
&lt;P&gt;To move the data back into the original data table, simply select the original table and go to&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; Tables==&amp;gt;Update&lt;/P&gt;
&lt;P&gt;In the dialog window, select your summary table as the one to update with.&lt;/P&gt;
&lt;P&gt;Select Match Columns, and select both ID and use_yn as matching cells, and click on OK.&amp;nbsp; The N Rows column is your count&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 03:29:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243411#M48038</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-01-29T03:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: is there an easy way of creating count variable</title>
      <link>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243457#M48045</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14229"&gt;@billi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have embedded both solutions from the link in your data table attached.&lt;/P&gt;
&lt;P&gt;the first uses the colum IDIndex with the following formula: If( :ID != Lag( :ID, 1 ) | Row() == 1, 1, Lag(:IDIndex, 1 ) + 1&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;and the final column IDCount with the formula: Col Maximum(:IDIndex, :ID)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the second option will also hold in case the data is not correctly sorted. it uses the column IDIndex2 with the formula: Sum( :ID[Index( 1, Row() )] == :ID )&lt;/P&gt;
&lt;P&gt;and the column IDCount2 with the formula: Col Maximum(:IDIndex2, :ID)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please let us know what works best for you.&lt;/P&gt;
&lt;P&gt;ron&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 10:30:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243457#M48045</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2020-01-29T10:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: is there an easy way of creating count variable</title>
      <link>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243563#M48060</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;Thank you very much for reply. This was very easy and worked for me. Appreciate your help.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 16:21:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243563#M48060</guid>
      <dc:creator>billi</dc:creator>
      <dc:date>2020-01-29T16:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: is there an easy way of creating count variable</title>
      <link>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243666#M48074</link>
      <description>&lt;P&gt;Just a quick vote for a very simple formula.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Number( :ID, :ID, :use_yn )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This column formula returns the number of times :ID and :use_yn are the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 20:15:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/is-there-an-easy-way-of-creating-count-variable/m-p/243666#M48074</guid>
      <dc:creator>Byron_JMP</dc:creator>
      <dc:date>2020-01-29T20:15:53Z</dc:date>
    </item>
  </channel>
</rss>

