<?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 JSL Creating a New Column from Components in another Column Character Scripting in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-Creating-a-New-Column-from-Components-in-another-Column/m-p/371125#M62104</link>
    <description>&lt;P&gt;Suppose I have input column&amp;nbsp; and want to create a new column based it's contents. The input column will always have a total of 8 slashes like below. However, sometimes there will be actual data of varying lengths between them. Thus... I want to indicate in a new column when there is data with a simple 'Y' and all other places would be 'N' over a large number of rows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Input Column&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Desired_Output&lt;/P&gt;&lt;P&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; NNNNNNNNN&lt;/P&gt;&lt;P&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;NNNNNNNNN&lt;/P&gt;&lt;P&gt;////a/b///&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; NNNNYYNNN&lt;/P&gt;&lt;P&gt;a////////&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; YNNNNNNNN&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:27:46 GMT</pubDate>
    <dc:creator>fat_angus</dc:creator>
    <dc:date>2023-06-10T23:27:46Z</dc:date>
    <item>
      <title>JSL Creating a New Column from Components in another Column Character Scripting</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Creating-a-New-Column-from-Components-in-another-Column/m-p/371125#M62104</link>
      <description>&lt;P&gt;Suppose I have input column&amp;nbsp; and want to create a new column based it's contents. The input column will always have a total of 8 slashes like below. However, sometimes there will be actual data of varying lengths between them. Thus... I want to indicate in a new column when there is data with a simple 'Y' and all other places would be 'N' over a large number of rows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Input Column&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Desired_Output&lt;/P&gt;&lt;P&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; NNNNNNNNN&lt;/P&gt;&lt;P&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;NNNNNNNNN&lt;/P&gt;&lt;P&gt;////a/b///&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; NNNNYYNNN&lt;/P&gt;&lt;P&gt;a////////&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; YNNNNNNNN&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:27:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Creating-a-New-Column-from-Components-in-another-Column/m-p/371125#M62104</guid>
      <dc:creator>fat_angus</dc:creator>
      <dc:date>2023-06-10T23:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Creating a New Column from Components in another Column Character Scripting</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Creating-a-New-Column-from-Components-in-another-Column/m-p/371146#M62105</link>
      <description>&lt;P&gt;You could use double regex in a formula:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Regex(Regex(:Input Column, "[^/]", "Y", GLOBALREPLACE), "/", "N", GLOBALREPLACE)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;One regex to replace everything that isn't "/" with "Y" and other to replace "/" with "N".&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 19:02:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Creating-a-New-Column-from-Components-in-another-Column/m-p/371146#M62105</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-03-24T19:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Creating a New Column from Components in another Column Character Scripting</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Creating-a-New-Column-from-Components-in-another-Column/m-p/371153#M62106</link>
      <description>Thanks for the reply. Wasn't familiar with this function and it is useful/helpful. This takes care of the slashes but gives me a 'Y' for every letter in the string. I only want one 'Y' for all characters between the slashes.</description>
      <pubDate>Wed, 24 Mar 2021 19:58:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Creating-a-New-Column-from-Components-in-another-Column/m-p/371153#M62106</guid>
      <dc:creator>fat_angus</dc:creator>
      <dc:date>2021-03-24T19:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Creating a New Column from Components in another Column Character Scripting</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Creating-a-New-Column-from-Components-in-another-Column/m-p/371167#M62107</link>
      <description>&lt;P&gt;You can add just another regex, that replaces many characters by one:&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 );

dt = New Table( "Test",
	Add Rows( 4 ),
	New Column( "Input Column", Character, "Nominal", Set Values( {"////////", "////////", "////aaaa/b///", "aBCD////////"} ) ),
	New Column( "Formula",
		Character,
		"Nominal",
		Formula( Regex( Regex( Regex( :Input Column, "[a-z]+", "A", GLOBALREPLACE, IGNORECASE ), "[^/]", "Y", GLOBALREPLACE ), "/", "N", GLOBALREPLACE ) ),
		Set Selected,
		Set Display Width( 246 )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Mar 2021 21:30:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Creating-a-New-Column-from-Components-in-another-Column/m-p/371167#M62107</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2021-03-24T21:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Creating a New Column from Components in another Column Character Scripting</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Creating-a-New-Column-from-Components-in-another-Column/m-p/371182#M62110</link>
      <description>&lt;P&gt;Howewer, to return 8 characters in each case you may use another formula, see formula2 in that table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "Test 3",
	Add Rows( 4 ),
	New Column( "Input Column",
		Character,
		"Nominal",
		Set Values( {"////////", "////////", "////aaaa/b///", "aBCD////////"} )
	),
	New Column( "Formula",
		Character,
		"Nominal",
		Formula(
			Regex(
				Regex(
					Regex( :Input Column, "[a-z]+", "A", GLOBALREPLACE, IGNORECASE ),
					"[^/]",
					"Y",
					GLOBALREPLACE
				),
				"/",
				"N",
				GLOBALREPLACE
			)
		),
		Set Display Width( 246 )
	),
	New Column( "Formula2",
		Character,
		"None",
		Formula(
			item_lst = Words( Substitute( :Input Column, "/", "/;" ), ";" );
			result_str = "";
			For( i = 1, i &amp;lt;= N Items( item_lst ), i++,
				If( item_lst[i] == "/",
					result_str = result_str || "N",
					result_str = result_str || "Y"
				)
			);
			result_str;
		),
		Set Selected,
		Set Display Width( 394 )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Mar 2021 21:52:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Creating-a-New-Column-from-Components-in-another-Column/m-p/371182#M62110</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2021-03-24T21:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Creating a New Column from Components in another Column Character Scripting</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Creating-a-New-Column-from-Components-in-another-Column/m-p/371198#M62111</link>
      <description>&lt;P&gt;Very big thank you! And to all others that helped. The Formula2 nailed it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 23:48:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Creating-a-New-Column-from-Components-in-another-Column/m-p/371198#M62111</guid>
      <dc:creator>fat_angus</dc:creator>
      <dc:date>2021-03-24T23:48:50Z</dc:date>
    </item>
  </channel>
</rss>

