<?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: I am trying to reset columns with a character (&amp;quot;&amp;lt;&amp;quot;) to numeric and retain the &amp;quot;&amp;lt;&amp;quot; in another column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677446#M86378</link>
    <description>&lt;P&gt;Unfortunately I'm not following how that code applies to my original question.&amp;nbsp; I probably was not clear in my original post or am missing something (I'm a jsl novice).&amp;nbsp; In any case, I'll keep trying and may need to re-frame my question.&amp;nbsp; (By the way, I have a very large number of columns in play, and all but the datetime column need this treatment - far too many to define by hand.)&amp;nbsp; Thanks again.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Sep 2023 17:14:53 GMT</pubDate>
    <dc:creator>learning_JSL</dc:creator>
    <dc:date>2023-09-13T17:14:53Z</dc:date>
    <item>
      <title>I am trying to reset columns with a character ("&lt;") to numeric and retain the "&lt;" in another column</title>
      <link>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677359#M86367</link>
      <description>&lt;P&gt;Hi - I have a table with columns that are made up of lab results (numeric values) that were entered as a text string.&amp;nbsp; They are text string because some have a "&amp;lt;" in front of the numeric value.&amp;nbsp; I need to be able to perform numeric calculations on the values so I am trying to remove the "&amp;lt;" symbol and place it in a new column that is named "ORIGCOLNAME_QUALIFIER" (where ORIGCOLNAME is the name of the column from which the "&amp;lt;" symbols were removed).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, the below code is not working.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

compList = {};
For( i = 1, i &amp;lt;= N Cols( dt ), i++,
colName = Column( dt, i ) &amp;lt;&amp;lt; get name;
);

// Create the columns
For Each( {comp, i}, compList,
Eval(
Parse(
"dt &amp;lt;&amp;lt; New Column( \!"" || compList[i] || "_QUALIFIER" ||
"\!",
character, nominal,
formula(
x=.; 

if (comp &amp;lt;&amp;lt; contains ("&amp;lt;"), x = &amp;lt;);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I get the following message:&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="learning_JSL_0-1694613341772.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/56614iA33DB7B30E179AE2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="learning_JSL_0-1694613341772.png" alt="learning_JSL_0-1694613341772.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Any input would be most appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 19:08:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677359#M86367</guid>
      <dc:creator>learning_JSL</dc:creator>
      <dc:date>2023-09-13T19:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to reset columns with a character ("&lt;") to numeric and retain the "&lt;" in another column</title>
      <link>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677377#M86369</link>
      <description>&lt;P&gt;Table attached, just in case.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 14:13:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677377#M86369</guid>
      <dc:creator>learning_JSL</dc:creator>
      <dc:date>2023-09-13T14:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to reset columns with a character ("&lt;") to numeric and retain the "&lt;" in another column</title>
      <link>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677382#M86370</link>
      <description>&lt;P&gt;This might give some ideas on what you could do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(2),
	Compress File When Saved(1),
	New Column("Column 1", Character, "Nominal", Set Values({"&amp;lt;1", "&amp;lt;3"})),
	New Column("Column 2", Character, "Nominal", Set Values({"&amp;lt;2", "&amp;lt;4"}))
);


col_names = dt &amp;lt;&amp;lt; Get Column Names("String");

For Each({col_name}, col_names,
	dt &amp;lt;&amp;lt; New Column(col_name ||"_Q", Numeric, Continuous, &amp;lt;&amp;lt; Set Each Value(
		Num(Substitute(AsColumn(dt, col_name), "&amp;lt;", ""));
	));
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Search Scripting Index and Scripting Guide for Substitute() to learn more about how it can be used&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 14:22:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677382#M86370</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-09-13T14:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to reset columns with a character ("&lt;") to numeric and retain the "&lt;" in another column</title>
      <link>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677428#M86376</link>
      <description>&lt;P&gt;Thanks jthi - The first part of your code creates a new 2-row table with pre-named columns.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = New Table( "Untitled",
	Add Rows( 2 ),
	Compress File When Saved( 1 ),
	New Column( "Column 1", Character, "Nominal", Set Values( {"&amp;lt;1", "&amp;lt;3"} ) ),
	New Column( "Column 2", Character, "Nominal", Set Values( {"&amp;lt;2", "&amp;lt;4"} ) )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However,&amp;nbsp;I am trying to keep my column names intact while adding a new column with name corresponding to each of my existing columns but with "_qualifier" on the end.&amp;nbsp; &amp;nbsp; (Ex:&amp;nbsp; say my existing columns are chloride (character), sulfate (sulfate), ..., the new columns would be chloride (numeric), sulfate (numeric), chloride_qualifier (character), sulfate_qualifier (character), etc.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 19:11:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677428#M86376</guid>
      <dc:creator>learning_JSL</dc:creator>
      <dc:date>2023-09-13T19:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to reset columns with a character ("&lt;") to numeric and retain the "&lt;" in another column</title>
      <link>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677435#M86377</link>
      <description>&lt;P&gt;Just substitute that part with a reference to your table. You might also want to cleanup the column selection if you know which should be used (instead of just using &amp;lt;&amp;lt; get column names("String") to get all columns).&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 16:20:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677435#M86377</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-09-13T16:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to reset columns with a character ("&lt;") to numeric and retain the "&lt;" in another column</title>
      <link>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677446#M86378</link>
      <description>&lt;P&gt;Unfortunately I'm not following how that code applies to my original question.&amp;nbsp; I probably was not clear in my original post or am missing something (I'm a jsl novice).&amp;nbsp; In any case, I'll keep trying and may need to re-frame my question.&amp;nbsp; (By the way, I have a very large number of columns in play, and all but the datetime column need this treatment - far too many to define by hand.)&amp;nbsp; Thanks again.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 17:14:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677446#M86378</guid>
      <dc:creator>learning_JSL</dc:creator>
      <dc:date>2023-09-13T17:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to reset columns with a character ("&lt;") to numeric and retain the "&lt;" in another column</title>
      <link>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677480#M86380</link>
      <description>&lt;P&gt;First, when posting JSL to a Community Discussion page, please use the JSL icon at the top of the page, so the code properly shows up ion the page.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is a script that checks for &amp;lt; and for any Post Script values such as "J" or "UJ" etc, and moves the values to a new Qualifier column.&amp;nbsp; It then converts the column from a character column to a numeric column&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1694631981313.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/56625i2EC8BBD9A5FF73D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1694631981313.png" alt="txnelson_0-1694631981313.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

colNames = dt &amp;lt;&amp;lt; get column names( string, character );

For Each( {col, i}, colNames,
	GTFound = "NO";
	postScriptFound = "NO";
	
	// Find rows that have &amp;lt; in them
	theRows = dt &amp;lt;&amp;lt; get rows where( Contains( As Column( dt, col ), "&amp;lt;" ) );
	// If &amp;lt; is found then 
	//      1. Create a new column to hold the &amp;lt; in
	//      2. Loop through the rows with &amp;lt; and
	//         1. Add &amp;lt; to the appropriate row in the new Qualifier column
	//         2. Delete the &amp;lt; from the current column
	If( N Rows( theRows ) &amp;gt; 0,
		GTFound = "YES";
		dt &amp;lt;&amp;lt; add Multiple Columns( col, 1, Character );
		Column( dt, N Cols( dt ) ) &amp;lt;&amp;lt; set name( col || "_QUALIFIER" );
		dt &amp;lt;&amp;lt; move selected column( after( As Column( col ) ) );
		For Each( {fixRow, k}, theRows,
			As Column( dt, col || "_QUALIFIER" )[fixRow] = "&amp;lt;";
			As Column( dt, col )[fixRow] = Substr( Column( col )[fixRow], 2 );
		);
	);
	
	// Find if there are any post script values on any of the rows
	theRows = dt &amp;lt;&amp;lt; get rows where( Word( 2, As Column( dt, col ), " " ) != "" );
	
	// If found, then if a new column has not already been add, add the new Qualifer column
	If( N Rows( theRows ) &amp;gt; 0,
		postScriptFound = "YES";
		If( GTFound == "NO",
			dt &amp;lt;&amp;lt; add Multiple Columns( col, 1, Character );
			Column( dt, N Cols( dt ) ) &amp;lt;&amp;lt; set name( col || "_QUALIFIER" );
			dt &amp;lt;&amp;lt; move selected column( after( As Column( col ) ) );
		);

		// Loop through the rows with post scripts and
		//     1. Add the post scripts to the Qualifer column
		//     2. Delete the post scripts from the current column
		For Each( {fixRow, k}, theRows,
			As Column( dt, col || "_QUALIFIER" )[fixRow] = Trim(
				As Column( dt, col || "_QUALIFIER" )[fixRow] || " " || Word( 2, As Column( dt, col )[fixRow], " " )
			);
			As Column( dt, col )[fixRow] = Word( 1, As Column( dt, col )[fixRow], " " );
		);
	);
	
	// If eiter &amp;lt; or Post Scripts were found, convert the column to numeric, continuous
	If( GTFound == "YES" | postScriptFound == "YES",
		Column( dt, col ) &amp;lt;&amp;lt; data type( numeric ) &amp;lt;&amp;lt; modeling type( continuous )
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 19:13:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677480#M86380</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-09-13T19:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to reset columns with a character ("&lt;") to numeric and retain the "&lt;" in another column</title>
      <link>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677485#M86382</link>
      <description>&lt;P&gt;That worked perfectly.&amp;nbsp; And the comment lines are most helpful as they will help me understand each step in the process.&amp;nbsp; This augments what I can find in the help documentation as I learn how to actually apply these jsl fundamentals to my dataset.&amp;nbsp; Thank you very much.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 19:17:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677485#M86382</guid>
      <dc:creator>learning_JSL</dc:creator>
      <dc:date>2023-09-13T19:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to reset columns with a character ("&lt;") to numeric and retain the "&lt;" in another column</title>
      <link>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677550#M86385</link>
      <description>&lt;P&gt;I might not understand your need, and there are likely more efficient ways to do this, especially if your data has many rows, but here is a brute force method if this table looks like the result you want.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gzmorgan0_0-1694638162959.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/56637iAF1C0133A6710F90/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gzmorgan0_0-1694638162959.png" alt="gzmorgan0_0-1694638162959.png" /&gt;&lt;/span&gt;&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);
id_colnames = {"well", "Sample Date"};

dt = Current Data Table();
nr =nrow(dt);

col_names = dt &amp;lt;&amp;lt; Get Column Names("String");

For Each({col_name}, col_names,
   If( !Contains(id_colnames, col_name),
   	  dt &amp;lt;&amp;lt; New Column(col_name||"_Q", Character, &amp;lt;&amp;lt; Set Each Value(
   	  	If(Contains(AsColumn(dt,col_name), "&amp;lt;"), "&amp;lt;",""))
   	  );
   	  
      curr_col = column(dt,col_name);
      For(i=1, i&amp;lt;=nr, i++,
         curr_col[i]= Substitute( word(1, curr_col[i]) ,"&amp;lt;","");
       );
      curr_col &amp;lt;&amp;lt; Set Data Type(Numeric) &amp;lt;&amp;lt; Set Modeling Type ("Continuous");
   	); // end If()
 );  //end For Each()
&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 20:50:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/677550#M86385</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2023-09-13T20:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to reset columns with a character ("&lt;") to numeric and retain the "&lt;" in another column</title>
      <link>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/679795#M86588</link>
      <description>&lt;P&gt;Thanks GZMorngan0!&amp;nbsp; &amp;nbsp; Sorry I'm slow responding.&amp;nbsp; I just checked back on the thread.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate seeing another technique.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 19:16:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/I-am-trying-to-reset-columns-with-a-character-quot-lt-quot-to/m-p/679795#M86588</guid>
      <dc:creator>learning_JSL</dc:creator>
      <dc:date>2023-09-20T19:16:56Z</dc:date>
    </item>
  </channel>
</rss>

