<?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 adding prefix to Character column values in an efficient way in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/adding-prefix-to-Character-column-values-in-an-efficient-way/m-p/46889#M26716</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have a character column with an unknown number of different values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to add a string prefix to each value but I struggle with doing so in an efficient way without creating a new column and without a for loop because it is slow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example for a single value:&lt;/P&gt;&lt;P&gt;Value is "12"&lt;/P&gt;&lt;P&gt;new value should be "PREFIX 12"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do this with JMP 12?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code without the step to add the prefix:&lt;/P&gt;&lt;PRE&gt;Names Default to Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:Age &amp;lt;&amp;lt; Data Type( Character );
// Get the values of age into a vector
ageVals = dt:Age &amp;lt;&amp;lt; getValues;
// do not know what to do here. would like to add a PREFIX without a for loop (which would be slow)
???
// Put the new values back into the column
dt:Age &amp;lt;&amp;lt; setValues(ageVals);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;</description>
    <pubDate>Wed, 08 Nov 2017 11:36:00 GMT</pubDate>
    <dc:creator>newbie_alex</dc:creator>
    <dc:date>2017-11-08T11:36:00Z</dc:date>
    <item>
      <title>adding prefix to Character column values in an efficient way</title>
      <link>https://community.jmp.com/t5/Discussions/adding-prefix-to-Character-column-values-in-an-efficient-way/m-p/46889#M26716</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have a character column with an unknown number of different values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to add a string prefix to each value but I struggle with doing so in an efficient way without creating a new column and without a for loop because it is slow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example for a single value:&lt;/P&gt;&lt;P&gt;Value is "12"&lt;/P&gt;&lt;P&gt;new value should be "PREFIX 12"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do this with JMP 12?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code without the step to add the prefix:&lt;/P&gt;&lt;PRE&gt;Names Default to Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:Age &amp;lt;&amp;lt; Data Type( Character );
// Get the values of age into a vector
ageVals = dt:Age &amp;lt;&amp;lt; getValues;
// do not know what to do here. would like to add a PREFIX without a for loop (which would be slow)
???
// Put the new values back into the column
dt:Age &amp;lt;&amp;lt; setValues(ageVals);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 11:36:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/adding-prefix-to-Character-column-values-in-an-efficient-way/m-p/46889#M26716</guid>
      <dc:creator>newbie_alex</dc:creator>
      <dc:date>2017-11-08T11:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: adding prefix to Character column values in an efficient way</title>
      <link>https://community.jmp.com/t5/Discussions/adding-prefix-to-Character-column-values-in-an-efficient-way/m-p/46890#M26717</link>
      <description>&lt;P&gt;I believe the quickest way to do this would be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:Age &amp;lt;&amp;lt; Data Type( Character );
for each row(
	dt:Age = "PREFIX " || dt:Age
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Nov 2017 11:50:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/adding-prefix-to-Character-column-values-in-an-efficient-way/m-p/46890#M26717</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-11-08T11:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: adding prefix to Character column values in an efficient way</title>
      <link>https://community.jmp.com/t5/Discussions/adding-prefix-to-Character-column-values-in-an-efficient-way/m-p/46893#M26720</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is actually quicker than expected even for my big data set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you please help me understand why this is quicker than a regular for loop?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 12:33:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/adding-prefix-to-Character-column-values-in-an-efficient-way/m-p/46893#M26720</guid>
      <dc:creator>newbie_alex</dc:creator>
      <dc:date>2017-11-08T12:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: adding prefix to Character column values in an efficient way</title>
      <link>https://community.jmp.com/t5/Discussions/adding-prefix-to-Character-column-values-in-an-efficient-way/m-p/46902#M26725</link>
      <description>&lt;P&gt;I suspect the reason this is faster, is because it is a function that has very specific actions, and therefore has been optimized.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 14:40:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/adding-prefix-to-Character-column-values-in-an-efficient-way/m-p/46902#M26725</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-11-08T14:40:19Z</dc:date>
    </item>
  </channel>
</rss>

