Subscribe Bookmark RSS Feed

List Intersection Performance

pmroz

Super User

Joined:

Jun 23, 2011

Here’s a
question for all you JSL wizards.


 




I have text
data that I need to group in different ways.
style=""> 
My table looks like this:





style="font-weight: bold; text-decoration: underline; font-family: monospace;">My
Value    Category 1  
 Category 2    Category 3


style="font-family: monospace;">
AA   
   
  1   
       
 1    
        0


style="font-family: monospace;">
BB   
      0  
          1
            0


style="font-family: monospace;">
CC   
      1  
          0  
          0


style="font-family: monospace;">
DD   
      0  
          1  
          0


style="font-family: monospace;">
EE   
      1  
          0  
          0


style="font-family: monospace;">
FF   
      0  
          0  
          0


style="font-family: monospace;">
AA
         1  
          1  
          0


style="font-family: monospace;">
BB
         0  
          1  
          0


style="font-family: monospace;">
GG
         0  
          0  
          0


style="font-family: monospace;">
HH
         0  
          0  
          1


style="font-family: monospace;">
MM
         0  
          1  
          1


 




The category
columns allow me to group the data in different ways.
style=""> 
The
categories for this example come from the
following lists:


 





style="font-size: 10pt; font-family: "Courier New"; color: black;">Category
1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">
{

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"AA"

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"CC"

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"EE"

style="font-size: 10pt; font-family: "Courier New"; color: black;">}

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">Category
2

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">
{

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"AA"

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"BB"

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"DD"

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"MM"

style="font-size: 10pt; font-family: "Courier New"; color: black;">}

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: black;">Category
3

style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: black;">
{

style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: purple;">"KK"

style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: black;">

style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: purple;">"MM"

style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: black;">}

style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: navy;">;



 




If you’re
wondering why I don’t just add one category column,
it’s because there can be
overlap in the category lists. 
Thus I
need a separate column for each category.


 




If a value
in the MyValue
column matches a
value in a category list, then the category column is 1, otherwise it
is 0.
This allows me to rapidly perform separate analyses of the data
matching each category.

 




My problem
is one of performance when calculating the category columns.
style=""> 
It’s
not bad for small tables (10,000 rows, 3
categories, small category lists).
style=""> 
However it gets bogged down
for larger datasets (300,000 rows, 200
categories, large category lists).
style=""> 
Some
of the category lists can be quite large (2000 values).


 




Basically I
need a fast way to do some sort of list intersection between the data
in the MyValue
column and the data in each
category list. 
This is a very simple
example but it illustrates the concept.

 




Here’s the
logic I’m using for one category.
style=""> 
The
ability to find matches between a list and a column using
style="">SELECT WHERE

is very powerful. 
If it can be sped up somehow
I’d love to know how!


 





style="font-size: 10pt; font-family: "Courier New"; color: black;">one_category

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"Category
1"

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">category_list

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">
{

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"AA"

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"CC"

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"EE"

style="font-size: 10pt; font-family: "Courier New"; color: black;">}

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">

 





style="font-size: 10pt; font-family: "Courier New"; color: black;">nr

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">nrows

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">dt)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">col_zeroes

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">nr

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: teal;">1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: teal;">0

style="font-size: 10pt; font-family: "Courier New"; color: black;">)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">

 





style="font-size: 10pt; font-family: "Courier New"; color: green;">//
Add the category column

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">dt

style="font-size: 10pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">new
column

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">one_category

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">
numeric)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">column

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">dt

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">
one_category)

style="font-size: 10pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 10pt; font-family: "Courier New"; color: black;">
hide(

style="font-size: 10pt; font-family: "Courier New"; color: teal;">1

style="font-size: 10pt; font-family: "Courier New"; color: black;">)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">

 





style="font-size: 10pt; font-family: "Courier New"; color: green;">//
Set the entire column to be
zeroes initially

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">column

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">dt

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">
one_category)

style="font-size: 10pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 10pt; font-family: "Courier New"; color: black;">
values(col_zeroes[

style="font-size: 10pt; font-family: "Courier New"; color: teal;">0

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: teal;">1

style="font-size: 10pt; font-family: "Courier New"; color: black;">])

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">

 





style="font-size: 10pt; font-family: "Courier New"; color: green;">//
Select all rows with values
matching this category

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">dt

style="font-size: 10pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 10pt; font-family: "Courier New"; color: black;">
select where(

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">contains

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">category_list

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: navy;">:

style="font-size: 10pt; font-family: "Courier New"; color: black;">My
Value))

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">

 





style="font-size: 10pt; font-family: "Courier New"; color: green;">//
Get a list of the selected
rows

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">one_cat_rows

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">
dt

style="font-size: 10pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 10pt; font-family: "Courier New"; color: black;">
get selected
rows()

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">

 





style="font-size: 10pt; font-family: "Courier New"; color: green;">//
Set all matching rows to 1 for
this category

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">if

style="font-size: 10pt; font-family: "Courier New"; color: black;">
(

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">nrows

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">one_cat_rows)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">>

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: teal;">0

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">     

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">column

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">dt

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">
one_category)[one_cat_rows]

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: teal;">1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: black;">)

style="font-size: 10pt; line-height: 115%; font-family: "Courier New"; color: navy;">;
6 REPLIES
My instinct says that if you can keep away from working with data tables as much as possible then the whole process could be speeded up quite a bit. I don't know if the following will do that for large data sets - this one's very small - but you could try doing something like this, in which I've created some dummy data plus three categories, then just done the actual matching in a loop by comparing the respective lists. I've also created a binary matrix for checking purposes, but haven't actually used it in the calculations:


style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">clear
log

style="font-size: 9pt; font-family: "Courier New"; color: black;">()

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Create a list of MYVALUEs to
work with - everything from 'AAA' to 'ZZZ';

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">Alphabet

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"ABCDEFGHIJKLMNOPQRSTUVWXYZ"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">MyValues

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{}

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">for

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
Letter1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">substr

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">Alphabet

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">for

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">             
Letter2

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">substr

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">Alphabet

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">             

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">for

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">k

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
k

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
k

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                    

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">insert
into

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">MyValues

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Letter1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Letter2

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">substr

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">Alphabet

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
k

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">))

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                    
)





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">             
)





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">Nvalues

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">nItems

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">MyValues)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">show

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">Nvalues)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">Whatever

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">repeat

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: teal;">0

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Nvalues)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">for

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: black;">Nvalues

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Whatever[i]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">random
uniform

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: teal;">0

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">100

style="font-size: 9pt; font-family: "Courier New"; color: black;">))

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Make a table with the above as
the first column;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">dt

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">new
table

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"My
Table"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">new
column

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"My
Values"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
character

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
values(MyValues))

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">new
column

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"My
Data"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
numeric

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
values(Whatever))





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Assume the above is the table I
want to work with;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Now create three categories as
lists within lists;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: black;">}

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"BAT"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"DOG"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"APE"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"HEN"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"CAT"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"PIG"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"EMU"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"COW"

style="font-size: 9pt; font-family: "Courier New"; color: black;">}

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">2

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"BYE"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"BFN"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"HI!"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"BOO"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"LOL"

style="font-size: 9pt; font-family: "Courier New"; color: black;">}

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">3

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"PPP"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"QQQ"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"RRR"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"SSS"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"TTT"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"UUU"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"VVV"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"WWW"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"XXX"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"YYY"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"ZZZ"

style="font-size: 9pt; font-family: "Courier New"; color: black;">}

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">show

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">NCats

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">nItems

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Create a matrix of zeros
(though strictly speaking we don't actually need it);

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">MyMat

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">J

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">Nvalues

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
NCats

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">0

style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">LocList

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">for

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: black;">NCats

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
LocList[i]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{})

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">show

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">LocList)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Find the row numbers of DT that
contain the category items;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">for

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: black;">NCats

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">for

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">nItems

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList[i])

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">             
RowPosition

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">contains

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">MyValues

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[i][

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: black;">])

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">             

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">if

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">RowPosition

style="font-size: 9pt; font-family: "Courier New"; color: navy;">>

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">0

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                    
MyMat[RowPosition

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Remove this
line if you don't want to use the matrix;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                    

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">insert
into

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">LocList[i]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
RowPosition)





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                    

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                    

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">print

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"Match
not
found in Category "

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">char

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">i)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">":
"

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[i][

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: black;">])

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                    
)





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">             
)





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      




style="font-size: 9pt; font-family: "Courier New"; color: green;">//
show(MyMat);

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: green;">//
LocList contains all the row
numbers I need to create the subtables;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">show

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">LocList)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Add the matrix columns to DT if
you want to, but we won't actually be using them;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">for

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: black;">NCats

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
dt

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">new
column

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"Category"

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">char

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">i)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
numeric

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
values(MyMat[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">0

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i]))





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      




style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Finally create subtables from
the row numbers in LocList;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">for

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: black;">NCats

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
dt

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 9pt; font-family: "Courier New"; color: black;">
select rows(LocList[i])

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
dt

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 9pt; font-family: "Courier New"; color: black;">
subset(visible)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
dt

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 9pt; font-family: "Courier New"; color: black;">
clear row states

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      




style="font-size: 9pt; line-height: 115%; font-family: "Courier New"; color: green;">//
End of program;

pmroz

Super User

Joined:

Jun 23, 2011

David,

Thanks for your reply. I tried a similar approach but got hung up on this statement:

MyMat = J(Nvalues, NCats, 0);

I ran out of memory when nvalues = 300,000 and ncats = 170! I'm on a PC with 2 GB of RAM, which is typical of our users.

Also, in the "real" application I'm using associative arrays to hold all the categories.

Regards,
Peter
Hi again Peter - you can remove the matrix completely if it's occupying valuable space, as it's not actually doing anything. I've recoded the original program slightly below to exclude it, and added a few lines to report where the time is being taken to run it, and I'm finding that almost all the time is being spent on the original creation of the data table (which slows down to a crawl as it builds the list), which of course you don't need to do, as the data already exists. Once the table has been created, the actual matching on the admittedly very small lists I've created takes no more than couple of seconds on my laptop (I've also got 2 Gbytes here), so perhaps the problem is the length of the character strings - is that possible? Could you try truncating the data to just a few characters to do a preliminary run, use that to set up a very much smaller data set, and then do a second loop on that data set to see which apparent matches are real?


style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 





style="font-size: 9pt; font-family: "Courier New"; color: black;">TimeNow

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Function

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{Label}

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
Display

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Label

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">":
"

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">
(

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Format

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Time
Of Day

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Today

style="font-size: 9pt; font-family: "Courier New"; color: black;">()

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"h:m:s"

style="font-size: 9pt; font-family: "Courier New"; color: black;">
))

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Print

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Display )

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Status
Msg

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Display )

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Wait

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">0

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 




style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Clear
Log

style="font-size: 9pt; font-family: "Courier New"; color: black;">()

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Create MYLIST to work with -
everything from 'AAAA' to 'RRRR';

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">ni

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">17

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Choose 17 to
get about 300,000 values;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 




style="font-size: 9pt; font-family: "Courier New"; color: black;">Alphabet

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"ABCDEFGHIJKLMNOPQRSTUVWXYZ"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">NumVals

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
ni

style="font-size: 9pt; font-family: "Courier New"; color: navy;">*

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">*

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">*

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Show

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
NumVals )

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">MyList

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">As
List

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Repeat

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">0

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
NumVals )
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">TimeNow(

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"Start
Multiple Loop"

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">For

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
ni

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
TimeNow(

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"i
loop = "

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Char

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i )
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
Parti

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">*

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">*

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">*

style="font-size: 9pt; font-family: "Courier New"; color: black;">
(i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">-

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
Letter1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Substr

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Alphabet

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">For

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">             
Partj

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">*

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">*

style="font-size: 9pt; font-family: "Courier New"; color: black;">
(

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">-

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">             
Letter2

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Substr

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Alphabet

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">             

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">For

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
k

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
k

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
k

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                    
Partk

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">*

style="font-size: 9pt; font-family: "Courier New"; color: black;">
(k

style="font-size: 9pt; font-family: "Courier New"; color: navy;">-

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                    
Letter3

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Substr

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Alphabet

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
k

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                    

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">For

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
l

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
l

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">26

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
l

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                          
m

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Parti

style="font-size: 9pt; font-family: "Courier New"; color: navy;">+

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Partj

style="font-size: 9pt; font-family: "Courier New"; color: navy;">+

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Partk

style="font-size: 9pt; font-family: "Courier New"; color: navy;">+

style="font-size: 9pt; font-family: "Courier New"; color: black;">
l

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                          
MyList[m]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Letter1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Letter2

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Letter3

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Substr

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Alphabet

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
l

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                    
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">             
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">Nvalues

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">N
Items

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
MyList )

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Show

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Nvalues )

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">TimeNow(

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"End
Multiple Loop"

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">Whatever

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Repeat

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">0

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Nvalues )

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">For

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
Nvalues

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
Whatever[i]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Random
Uniform

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">0

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">100

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)





style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 




style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Make a table with the above as
the first column;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">TimeNow(

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"Create
Data Table"

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 




style="font-size: 9pt; font-family: "Courier New"; color: black;">dt

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">New
Table

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"My
Table"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">New
Column

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"My
Values"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
character

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
values(
MyList )
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">New
Column

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"My
Data"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
numeric

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
values(
Whatever )
)





style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 




style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Assume the above is the table I
want to work with;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">TimeNow(

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"Data
Table
Created"

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 




style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Close

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
dt

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
save(

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"c:\dt.jmp"

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Save a copy in case the program
doesn't complete - in which case start from here instead;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">dt

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Open

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"c:\dt.jmp"

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">MyVals

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">column

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">dt

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"My
Values"

style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 9pt; font-family: "Courier New"; color: black;">
get values

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">show

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">MyVals)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Now create ten categories as
lists within a list to test it;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 




style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: black;">}

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"BEAR"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"LION"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"DEER"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"MOLE"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"TIGER"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"BIRD"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"ELK"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"LYNX"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"VOLE"

style="font-size: 9pt; font-family: "Courier New"; color: black;">}

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">2

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"GOLD"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"IRON"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"LEAD"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"NEON"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"XENON"

style="font-size: 9pt; font-family: "Courier New"; color: black;">}

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">3

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"FAWN"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"GRAY"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"CYAN"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"RED"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"BLUE"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"FLAX"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"PINK"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"JADE"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"MINT"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"ONYX"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"TEAL"

style="font-size: 9pt; font-family: "Courier New&q
Sorry - it looks as though the program's too long to fit in a single post. Here's the rest of it:


style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">




style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 





style="font-size: 9pt; font-family: "Courier New"; color: black;">dt

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Open

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"c:\dt.jmp"

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">MyVals

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">column

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">dt

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"My
Values"

style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 9pt; font-family: "Courier New"; color: black;">
get values

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">show

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">MyVals)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Now create ten categories as
lists within a list to test it;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 




style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">.

style="font-size: 9pt; font-family: "Courier New"; color: black;">}

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"BEAR"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"LION"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"DEER"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"MOLE"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"TIGER"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"BIRD"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"ELK"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"LYNX"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"VOLE"

style="font-size: 9pt; font-family: "Courier New"; color: black;">}

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">2

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"GOLD"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"IRON"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"LEAD"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"NEON"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"XENON"

style="font-size: 9pt; font-family: "Courier New"; color: black;">}

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">3

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"FAWN"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"GRAY"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"CYAN"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"RED"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"BLUE"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"FLAX"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"PINK"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"JADE"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"MINT"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"ONYX"

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"TEAL"

style="font-size: 9pt; font-family: "Courier New"; color: black;">}

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">4

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">5

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">2

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">6

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">3

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">7

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">8

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">2

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">9

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">3

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">10

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Show

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList )

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">NCats

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">N
Items

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList )

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 




style="font-size: 9pt; font-family: "Courier New"; color: black;">LocList

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">For

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
NCats

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
LocList[i]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
{}





style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Show

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
LocList )

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 




style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Find the row numbers of DT that
contain the category items;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 




style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">For

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
NCats

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
TimeNow(

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"Finding
category items: "

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">char

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">i)
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">For

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">N
Items

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[i]
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">             
RowPosition

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Contains

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
MyVals

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[i][

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">             

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">If

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
RowPosition

style="font-size: 9pt; font-family: "Courier New"; color: navy;">>

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">0

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                    

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Insert
Into

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
LocList[i]

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
RowPosition )

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">                    

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Print

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"Match
not
found in Category "

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Char

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i )

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: purple;">":
"

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">
CategoryList[i][

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">j

style="font-size: 9pt; font-family: "Courier New"; color: black;">]

style="font-size: 9pt; font-family: "Courier New"; color: black;">
)





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">             
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
)





style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      




style="font-size: 9pt; font-family: "Courier New"; color: green;">//
LocList contains all the row
numbers I need to create the subtables;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style=""> 




style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">Show

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
LocList )

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: green;">//
Finally create subtables from
the row numbers in LocList;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 





style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">For

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">=

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: teal;">1

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 9pt; font-family: "Courier New"; color: black;">
NCats

style="font-size: 9pt; font-family: "Courier New"; color: navy;">,

style="font-size: 9pt; font-family: "Courier New"; color: black;">
i

style="font-size: 9pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
TimeNow(

style="font-size: 9pt; font-family: "Courier New"; color: purple;">"Creating
subtables: "

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: navy;">||

style="font-size: 9pt; font-family: "Courier New"; color: black;">

style="font-size: 9pt; font-family: "Courier New"; color: rgb(0, 0, 221);">char

style="font-size: 9pt; font-family: "Courier New"; color: black;">(

style="font-size: 9pt; font-family: "Courier New"; color: black;">i)
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
dt

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 9pt; font-family: "Courier New"; color: black;">
select rows(
LocList[i]
)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
dt

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 9pt; font-family: "Courier New"; color: black;">
subset(
visible )

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      
dt

style="font-size: 9pt; font-family: "Courier New"; color: navy;"><<

style="font-size: 9pt; font-family: "Courier New"; color: black;">
clear row states

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">)

style="font-size: 9pt; font-family: "Courier New"; color: navy;">;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">
style="">      




style="font-size: 9pt; font-family: "Courier New"; color: green;">//
End of program;

style="font-size: 9pt; font-family: "Courier New"; color: black;">





style="font-size: 9pt; font-family: "Courier New"; color: black;">

 



 
ms

Super User

Joined:

Jun 23, 2011

I played around a little with this and I also find that performance becomes a problem when the number of rows or category items grow.

The most straightforward script I tried was this (borrowing the terminology from David's script). I used Loc instead of Contains to avoid problems with categories containing multiple items or items not in the data table.

pmroz

Super User

Joined:

Jun 23, 2011

Thank you all for your suggestions. For my situation the fastest method is to do the following:

1. Turn off evaluation of computed columns with: