<?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: JSL script for binning in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-script-for-binning/m-p/54520#M30829</link>
    <description>&lt;P&gt;&lt;FONT size="2" color="#FF0000"&gt;Note:&amp;nbsp; I just found another issue....well same issue more complex.&amp;nbsp; Some of the columns have double quotes in the names....that causes the script to error out.......&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" color="#FF0000"&gt;This could be worked around......but I think the easiest solution is to change the double quotes in the names to single quotes(manually) and then run the script with the change noted below.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;This is a common issue, and I should have protected for the issue.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;The 7th column is named:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;BONNE JAM JAR&amp;nbsp; T-LIGHT HOLDER&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Unless guarded for, JMP will interpret the name not as a single column name, but rather 2 columns,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;BONNE JAM JAR&amp;nbsp; T&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;and&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;LIGHT HOLDER&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;JMP will then try to subtract one from the other, because it finds a minus sign, "-" between the 2 names.&amp;nbsp; To protect against these complex column names, JMP has a function called :Name().&amp;nbsp; So if you replace the following line in the code:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Expr( __col__ ), Parse( ":" || Char( Column( dt, i ) &amp;lt;&amp;lt; get name ) )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="2"&gt;with:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Expr( __col__ ), Parse( ":Name(\!"" || Char( Column( dt, i ) &amp;lt;&amp;lt; get name )  || "\!")")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="2"&gt;it will work&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Apr 2018 06:05:41 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2018-04-06T06:05:41Z</dc:date>
    <item>
      <title>JSL script for binning</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-for-binning/m-p/54485#M30801</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a sparse matrix with 1248 rows and 2435 columns. My first column is CustomerID and remaining are products with quantity ordered by each customer as a value. Each column has a different range. I want to standardize the columns values to 1 - 5 by having cut points at 20 percentile. I found interactive binning addin can help me to accomplish if the number of columns are less. I am new to JMP and would appreciate if anyone could help me with JSL script to achieve this. Binning should exclude the missing value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I have attached my data table for reference. Thanks in Advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Tara&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Utility matrix.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/10227iBFE9611C2BADB30C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Utility matrix.png" alt="Utility matrix.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 13:00:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-for-binning/m-p/54485#M30801</guid>
      <dc:creator>Tara</dc:creator>
      <dc:date>2018-04-05T13:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script for binning</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-for-binning/m-p/54494#M30808</link>
      <description>&lt;P&gt;Here is a sample script that should do what you want.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA\Semiconductor Capability.jmp" );

For( i = 5, i &amp;lt;= N Cols( dt ), i++,
	Eval(
		Substitute(
				Expr(
					RowsP0_20 = dt &amp;lt;&amp;lt; get rows where( __col__ &amp;lt;= Col Quantile( __col__, .2 ) );
					RowsP20_40 = dt &amp;lt;&amp;lt; get rows where(
						__col__ &amp;gt; Col Quantile( __col__, .2 ) &amp;amp; __col__ &amp;lt;=
						Col Quantile( __col__, .4 )
					);
					RowsP40_60 = dt &amp;lt;&amp;lt; get rows where(
						__col__ &amp;gt; Col Quantile( __col__, .4 ) &amp;amp; __col__ &amp;lt;=
						Col Quantile( __col__, .6 )
					);
					RowsP60_80 = dt &amp;lt;&amp;lt; get rows where(
						__col__ &amp;gt; Col Quantile( __col__, .6 ) &amp;amp; __col__ &amp;lt;=
						Col Quantile( __col__, .8 )
					);
					RowsP80_100 = dt &amp;lt;&amp;lt; get rows where( __col__ &amp;gt; Col Quantile( __col__, .8 ) );

					__col__[RowsP0_20] = 1;
					__col__[RowsP20_40] = 2;
					__col__[RowsP40_60] = 3;
					__col__[RowsP60_80] = 4;
					__col__[RowsP80_100] = 1;
				),
			Expr( __col__ ), Parse( ":" || Char( Column( dt, i ) &amp;lt;&amp;lt; get name ) )
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The script is more complex than it would have to be.&amp;nbsp; That is, it could have used the As Column() to replace each of the points in the script that pointed to a column, however, this compute overhead made the running of the code, about a minute per column for processing.&amp;nbsp; The Substitute version of the code, has the whole thing processing in a few seconds.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 16:42:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-for-binning/m-p/54494#M30808</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-04-05T16:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script for binning</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-for-binning/m-p/54519#M30828</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your time and reply. The script worked fine for the first 7 columns. I could not figure out why it does not proceed further. I have attached the jmp file for your reference.&amp;nbsp;I made minor changes to your script: dt = Current Data Table (); , i = 2 and _col_[RowP80_100]&amp;nbsp; = 5. Rest remains the same.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tara&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 05:29:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-for-binning/m-p/54519#M30828</guid>
      <dc:creator>Tara</dc:creator>
      <dc:date>2018-04-06T05:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script for binning</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-for-binning/m-p/54520#M30829</link>
      <description>&lt;P&gt;&lt;FONT size="2" color="#FF0000"&gt;Note:&amp;nbsp; I just found another issue....well same issue more complex.&amp;nbsp; Some of the columns have double quotes in the names....that causes the script to error out.......&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" color="#FF0000"&gt;This could be worked around......but I think the easiest solution is to change the double quotes in the names to single quotes(manually) and then run the script with the change noted below.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;This is a common issue, and I should have protected for the issue.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;The 7th column is named:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;BONNE JAM JAR&amp;nbsp; T-LIGHT HOLDER&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Unless guarded for, JMP will interpret the name not as a single column name, but rather 2 columns,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;BONNE JAM JAR&amp;nbsp; T&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;and&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;LIGHT HOLDER&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;JMP will then try to subtract one from the other, because it finds a minus sign, "-" between the 2 names.&amp;nbsp; To protect against these complex column names, JMP has a function called :Name().&amp;nbsp; So if you replace the following line in the code:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Expr( __col__ ), Parse( ":" || Char( Column( dt, i ) &amp;lt;&amp;lt; get name ) )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="2"&gt;with:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Expr( __col__ ), Parse( ":Name(\!"" || Char( Column( dt, i ) &amp;lt;&amp;lt; get name )  || "\!")")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="2"&gt;it will work&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 06:05:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-for-binning/m-p/54520#M30829</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-04-06T06:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script for binning</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-for-binning/m-p/54521#M30830</link>
      <description>&lt;P&gt;Thanks Jim. I will manually recode those column names. Thanks once again for your help!.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 06:16:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-for-binning/m-p/54521#M30830</guid>
      <dc:creator>Tara</dc:creator>
      <dc:date>2018-04-06T06:16:54Z</dc:date>
    </item>
  </channel>
</rss>

