<?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: How to compute a match with JSL? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78255#M36366</link>
    <description>&lt;P&gt;I don't see the benefit to the JMP User Community of the statement in your last reply,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; "&lt;SPAN&gt;It's also quick to use a dictionary in excel……Set d = CreateObject("Scripting.Dictionary")&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P&gt;It seems that such a comment would be more appropriate on the Excel Discussion Forum&lt;/P&gt;</description>
    <pubDate>Mon, 08 Oct 2018 00:30:55 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2018-10-08T00:30:55Z</dc:date>
    <item>
      <title>How to compute a match with JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78193#M36358</link>
      <description>&lt;P&gt;Hello, everyone!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;In excel, "=offset(,match(,,)-1,match(,,)-1,,)" functions can be used to calculate, but the speed is slow when the data is large.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to do this with JSL?Thank you!&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="2018-10-09_16-19-31.png" style="width: 801px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12722iB925EE28EE8406EC/image-size/large?v=v2&amp;amp;px=999" role="button" title="2018-10-09_16-19-31.png" alt="2018-10-09_16-19-31.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Oct 2018 08:32:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78193#M36358</guid>
      <dc:creator>lwx228</dc:creator>
      <dc:date>2018-10-07T08:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute a match with JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78194#M36359</link>
      <description>d1 = Open( "$SAMPLE_DATA/Presidential Elections.jmp" );&lt;BR /&gt;d2 = New Table( "offset",&lt;BR /&gt;Add Rows( 8 ),&lt;BR /&gt;New Column( "State",&lt;BR /&gt;Character,&lt;BR /&gt;"Nominal",&lt;BR /&gt;Set Values(&lt;BR /&gt;{"Wyoming", "Montana", "Montana", "Alaska", "Wisconsin", "Nebraska", "Nevada", "Montana"}&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;New Column( "year",&lt;BR /&gt;Character,&lt;BR /&gt;"Nominal",&lt;BR /&gt;Set Values( {"1988", "1988", "1988", "1992", "2000", "1992", "2004", "1980"} )&lt;BR /&gt;),&lt;BR /&gt;New Column( "data", Character, "Nominal", ),&lt;BR /&gt;&lt;BR /&gt;);</description>
      <pubDate>Sun, 07 Oct 2018 08:32:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78194#M36359</guid>
      <dc:creator>lwx228</dc:creator>
      <dc:date>2018-10-07T08:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute a match with JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78195#M36360</link>
      <description>Calculate the value of "data" in table "offset" based on the data in table "Presidential Elections".&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you!</description>
      <pubDate>Sun, 07 Oct 2018 08:35:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78195#M36360</guid>
      <dc:creator>lwx228</dc:creator>
      <dc:date>2018-10-07T08:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute a match with JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78240#M36361</link>
      <description>&lt;P&gt;Since you are worried about speed with large tables, you might create a 'lookup table' in a long format so there is one row per value and then use with Join or Update to do the lookup.&amp;nbsp; Here is how that might look:&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 );

d1 = Open( "$SAMPLE_DATA/Presidential Elections.jmp" );
d2 = New Table( "offset",
	Add Rows( 8 ),
	New Column( "State",
		Character,
		"Nominal",
		Set Values(
			{"Wyoming", "Montana", "Montana", "Alaska", "Wisconsin", "Nebraska", "Nevada", "Montana"}
		)
	),
	New Column( "year",
		Character,
		"Ordinal",
		Set Values( {"1988", "1988", "1988", "1992", "2000", "1992", "2004", "1980"} )
	),
	New Column( "data",
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 12, 1 ))

);

//Move data to a long format
d3 = d1 &amp;lt;&amp;lt; Stack(
	columns(
		:Name( "1980" ),
		:Name( "1984" ),
		:Name( "1988" ),
		:Name( "1992" ),
		:Name( "1996" ),
		:Name( "2000" ),
		:Name( "2004" ),
		:Name( "2008" ),
		:Name( "2012" )
	),
	Source Label Column( "year" ),
	Stacked Data Column( "data" )
);
d3 &amp;lt;&amp;lt; Set Name( "Long format" );
d3:year &amp;lt;&amp;lt; Set Modeling Type("Ordinal");

//'Lookup' the values:
d2 &amp;lt;&amp;lt; Update( with(d3), Match Columns( :state=:state, :year=:year ), Add Columns from Update table( None ));

d3 &amp;lt;&amp;lt; Close window;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Oct 2018 13:51:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78240#M36361</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2018-10-07T13:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute a match with JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78241#M36362</link>
      <description>good job !Thank you!</description>
      <pubDate>Sun, 07 Oct 2018 14:16:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78241#M36362</guid>
      <dc:creator>lwx228</dc:creator>
      <dc:date>2018-10-07T14:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute a match with JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78243#M36363</link>
      <description>&lt;P&gt;If these columns are many, such as more than 1000……Let's say it's a date.&lt;/P&gt;&lt;P&gt;how do these columns implement the d3 table setup in the form of a variate loop.Thank you!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="2018-10-09_22-12-53.png" style="width: 774px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/12723i93E27CD3E395517E/image-size/large?v=v2&amp;amp;px=999" role="button" title="2018-10-09_22-12-53.png" alt="2018-10-09_22-12-53.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Oct 2018 14:22:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78243#M36363</guid>
      <dc:creator>lwx228</dc:creator>
      <dc:date>2018-10-07T14:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute a match with JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78244#M36364</link>
      <description>&lt;P&gt;Here are a few ways, to stack with a variable number of columns, if you are using match in excel today then one of the first two methds will likely work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//If the column positions do not change
d3_1 = d1 &amp;lt;&amp;lt; Stack(
	columns( Concat( [2 3], 4::10 )),
	Source Label Column( "year" ),
	Stacked Data Column( "data" ),
	Drop all other columns( 1 ),
	Keep( :state )
);


//If you want all columns
d1_clean = ( d1 &amp;lt;&amp;lt; Subset( All rows, columns( 1::10 ) ) );
d3_2 = d1_clean &amp;lt;&amp;lt; Stack(
	columns( 2:: ncol(d1_clean) ),
	Source Label Column( "year" ),
	Stacked Data Column( "data" ),
	Drop all other columns( 1 ),
	Keep( :state )
);


//If the column names are in a specific format

// - get column names
cn = d1 &amp;lt;&amp;lt; Get Column Names( string );

// - Find which columns match a format
//   (jmp does have some patter matching tools but I like regex, check out regexr.com)
matches = repeat(0, N Items(cn));
for(c=1, c&amp;lt;= N Items(cn), c++, if(!is missing(Regex(cn[c], "^\d+$")), matches[c] = 1));

// - Stack
d3_3 = d1 &amp;lt;&amp;lt; Stack(
	columns( loc(matches) ),
	Source Label Column( "year" ),
	Stacked Data Column( "data" ),
	Drop all other columns( 1 ),
	Keep( :state )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 07 Oct 2018 16:40:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78244#M36364</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2018-10-07T16:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute a match with JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78254#M36365</link>
      <description>Thank you very much for your help.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It's also quick to use a dictionary in excel……Set d = CreateObject("Scripting.Dictionary")&lt;BR /&gt;&lt;BR /&gt;but more than a million lines will have to be done differently.</description>
      <pubDate>Mon, 08 Oct 2018 00:02:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78254#M36365</guid>
      <dc:creator>lwx228</dc:creator>
      <dc:date>2018-10-08T00:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute a match with JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78255#M36366</link>
      <description>&lt;P&gt;I don't see the benefit to the JMP User Community of the statement in your last reply,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; "&lt;SPAN&gt;It's also quick to use a dictionary in excel……Set d = CreateObject("Scripting.Dictionary")&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P&gt;It seems that such a comment would be more appropriate on the Excel Discussion Forum&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 00:30:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78255#M36366</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-10-08T00:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute a match with JSL?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78278#M36371</link>
      <description>Yes, excel is convenient to use worksheet functions within 10,000 rows.&lt;BR /&gt;&lt;BR /&gt;Over 10,000 rows I'm used to doing this with a VBA dictionary.But dictionaries over 100,000 are slow.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now using this method of JMP, over 10 million lines are also fast.ThankS you!</description>
      <pubDate>Mon, 08 Oct 2018 09:13:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-compute-a-match-with-JSL/m-p/78278#M36371</guid>
      <dc:creator>lwx228</dc:creator>
      <dc:date>2018-10-08T09:13:38Z</dc:date>
    </item>
  </channel>
</rss>

