<?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: Increment by levels of character column (scripting) in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Increment-by-levels-of-character-column-scripting/m-p/230317#M45679</link>
    <description>&lt;P&gt;I like Jim's answer. You could also use a simple formula:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(
	Row() == 1, 1,
	:Have == Lag( :Have ), Lag( :Want ),
	Lag( :Want ) + 1
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or the equivalent script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each Row( If( Row() == 1, 1, :Have == Lag( :Have ), Lag( :Want ), Lag( :Want ) + 1 ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 23 Oct 2019 13:38:16 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2019-10-23T13:38:16Z</dc:date>
    <item>
      <title>Increment by levels of character column (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Increment-by-levels-of-character-column-scripting/m-p/230296#M45671</link>
      <description>&lt;P&gt;Maybe I'm again not seeing the wood before the trees; I just want to apply some numeric increment for every distinct level of a character column.&lt;/P&gt;&lt;P&gt;Same levels get the same increment, different levels get different numbers.&lt;/P&gt;&lt;P&gt;Assumption: Data are sorted by "Character_Column_Have". "Numeric_Increment_Want" should start with 1.&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Character_Column_Have&amp;nbsp; &amp;nbsp; Numeric_Increment_Want&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;AAA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;AAA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;BBB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;&lt;P&gt;CCD&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4&lt;/P&gt;&lt;P&gt;EEE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5&lt;/P&gt;&lt;P&gt;EEE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;The only result I achieved so far was to repeatedly crash my JMP by using "col **bleep** rank".&lt;/P&gt;&lt;P&gt;JMP and me could do better, right?&lt;/P&gt;&lt;P&gt;Thanks for every pointer!&lt;/P&gt;&lt;P&gt;Newbie&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 12:30:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Increment-by-levels-of-character-column-scripting/m-p/230296#M45671</guid>
      <dc:creator>Newbie2Jumpie</dc:creator>
      <dc:date>2019-10-23T12:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Increment by levels of character column (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Increment-by-levels-of-character-column-scripting/m-p/230307#M45676</link>
      <description>&lt;P&gt;Here is the formula that I would use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() == 1,
	Summarize( groups = by( :Character_Column_Have ) )
);
Contains( groups, :Character_Column_Have );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There are also other methods.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Use Recode to create a new column, changing the values found for the new numeric values wanted&lt;/LI&gt;
&lt;LI&gt;Use the Summary Platform with Character_Column_Have as the Group column to create a new data table with one row per value of Character_Column_Have.&amp;nbsp; Then create a new column that has a formula of &amp;nbsp;&amp;nbsp; Row().&amp;nbsp; Finally use the Update Platform to join the summary table with the original table. &amp;nbsp;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Wed, 23 Oct 2019 13:17:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Increment-by-levels-of-character-column-scripting/m-p/230307#M45676</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-10-23T13:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Increment by levels of character column (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Increment-by-levels-of-character-column-scripting/m-p/230317#M45679</link>
      <description>&lt;P&gt;I like Jim's answer. You could also use a simple formula:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(
	Row() == 1, 1,
	:Have == Lag( :Have ), Lag( :Want ),
	Lag( :Want ) + 1
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or the equivalent script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each Row( If( Row() == 1, 1, :Have == Lag( :Have ), Lag( :Want ), Lag( :Want ) + 1 ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Oct 2019 13:38:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Increment-by-levels-of-character-column-scripting/m-p/230317#M45679</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-10-23T13:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Increment by levels of character column (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Increment-by-levels-of-character-column-scripting/m-p/230541#M45721</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I tried all your approaches but it seems I cannot&amp;nbsp;make them work.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;One approach puzzles me conceptually. It addresses two input columns, while only character column is available for input.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Could you demonstrate one approach on the JMP dataset "Dolphins" please (excerpt below)?&lt;/P&gt;&lt;P&gt;Travel Morning 6&lt;BR /&gt;Feed Morning 28&lt;BR /&gt;... Travel Evening 13&lt;BR /&gt;Feed Evening 56&lt;BR /&gt;Social Evening 10&lt;/P&gt;&lt;P&gt;For the "Dolphins" levels Morning, Noon, Afternoon, Evening I'd expect the increments 1,2,3 resp. 4 (subject to sorting order)&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2019 13:56:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Increment-by-levels-of-character-column-scripting/m-p/230541#M45721</guid>
      <dc:creator>Newbie2Jumpie</dc:creator>
      <dc:date>2019-10-24T13:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Increment by levels of character column (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Increment-by-levels-of-character-column-scripting/m-p/230550#M45723</link>
      <description>&lt;P&gt;Here is the formula for the Numeric_Increment_Want column&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() == 1,
	Summarize( myGroups = by( :Period ) )
);
Contains( myGroups, :Period );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I had to change the previous code because the reference to "Groups" in the old code, conflicts with the Dolphins data table having a column named Groups.&amp;nbsp; So I changed the variable name to myGroups.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="myDolphins.PNG" style="width: 573px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/19859i1001320920614053/image-size/large?v=v2&amp;amp;px=999" role="button" title="myDolphins.PNG" alt="myDolphins.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Attached is the data table with the new column added&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2019 14:11:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Increment-by-levels-of-character-column-scripting/m-p/230550#M45723</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-10-24T14:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Increment by levels of character column (scripting)</title>
      <link>https://community.jmp.com/t5/Discussions/Increment-by-levels-of-character-column-scripting/m-p/230723#M45748</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;	New Column( "Increment",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula(
			If( Row() == 1,
	Summarize( myGroups = by( :Period ) )
);
Contains( myGroups, :Period );
		)
	);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I cannot explain why it now works. I also adjusted for "Groups". Weired. Anyway, I solved it like that and it works like a charm. Jim, thank you very much. Again!&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 07:40:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Increment-by-levels-of-character-column-scripting/m-p/230723#M45748</guid>
      <dc:creator>Newbie2Jumpie</dc:creator>
      <dc:date>2019-10-25T07:40:02Z</dc:date>
    </item>
  </channel>
</rss>

