<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: JMP Tabulate by list of column names in JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266337#M51874</link>
    <description>&lt;P&gt;Is this what you are looking for???&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=current data table();

// The list of columns to look for
theList={"Class","Student","Subject", "xxxxxx","xxxxxx"};

allColList = dt &amp;lt;&amp;lt; get column names(string);

// Remove any columns from theList that are not in the data table
For(i=n items(theList),i&amp;gt;=1, i--,
	If(n rows(loc(allColList,theList[i]))==0,
		remove from(theList,i,1)
	)
);

// Run the tabulate
Tabulate(
	Show Control Panel( 0 ),
	Add Table(
		Column Table( Analysis Columns( :Marks ), Statistics( Max ) ),
		Row Table( Grouping Columns( eval(theList) ) )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the different target columns play roles other than Grouping Columns, you will need to develop the code accounting for the different required input syntax.&lt;/P&gt;</description>
    <pubDate>Wed, 13 May 2020 10:23:01 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2020-05-13T10:23:01Z</dc:date>
    <item>
      <title>JMP Tabulate by list of column names in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266020#M51807</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have table and I want to tabulate it by column "student", column "subject" and column "class" but column "Subject" and column "class" is not necessary to available in the data.&lt;/P&gt;&lt;P&gt;If it has column "subject" but not column "class" then it should tabulate by column "student" and column "subject".&lt;/P&gt;&lt;P&gt;If&amp;nbsp;it has column "class" but not column "subject" then it should tabulate by column "student" and column "class".&lt;/P&gt;&lt;P&gt;If it has all the columns then it should tabulate by all three columns. Below are some examples.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 1: (It has both column "subject" and column "class")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Input:&lt;/U&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Class&lt;/TD&gt;&lt;TD&gt;Student&lt;/TD&gt;&lt;TD&gt;Marks&lt;/TD&gt;&lt;TD&gt;Subject&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;Math&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;Science&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;Science&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;Math&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;Science&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Output:&lt;/U&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Class&lt;/TD&gt;&lt;TD&gt;Student&lt;/TD&gt;&lt;TD&gt;Subject&lt;/TD&gt;&lt;TD&gt;max(Marks)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;Math&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;Science&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;Science&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;Math&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;Science&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 2: (It has column "Class" but not column "subject")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Input:&lt;/U&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Class&lt;/TD&gt;&lt;TD&gt;Student&lt;/TD&gt;&lt;TD&gt;Marks&lt;/TD&gt;&lt;/TR&gt;&lt;TR&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/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 3: (It has column "subject" but not column "class")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Input:&lt;/U&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Student&lt;/TD&gt;&lt;TD&gt;Marks&lt;/TD&gt;&lt;TD&gt;Subject&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;Math&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;Science&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;Science&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;Math&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;Science&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Output:&lt;/U&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Student&lt;/TD&gt;&lt;TD&gt;Subject&lt;/TD&gt;&lt;TD&gt;max(Marks)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;Math&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;Science&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;Math&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;Science&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me to resolve this problem.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 10:59:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266020#M51807</guid>
      <dc:creator>Rajat</dc:creator>
      <dc:date>2020-05-12T10:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Tabulate by list of column names in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266035#M51809</link>
      <description>&lt;P&gt;Run each of the 3 scenarios on a sample data table, saving each of the scripts from each run, into a script window.&amp;nbsp; Then take each of the appropriate scripts and put them into the following script in the designated position&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt= current data table();

colNames = dt &amp;lt;&amp;lt; get column names(string);

// Here is the IF() structure to add in the tabulate code to
If( N Rows(loc(colNames, "Subject" ) ) &amp;gt; 0 &amp;amp; N Rows(loc(colNames, "Class" ) ) &amp;gt; 0,
// Add in the tabulate code that has Student, Subject and Class


,
 N Rows(loc(colNames, "Subject" ) ) &amp;gt; 0,
 // Add in the tablulate code that has just Student and Subject
 
 
 ,
 N Rows(loc(colNames, "Class" ) ) &amp;gt; 0,
 // Add in the tablulate code that has just Student and Class
 
 );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 May 2020 11:42:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266035#M51809</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-12T11:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Tabulate by list of column names in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266285#M51860</link>
      <description>&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt; Thanks for replying.&lt;BR /&gt;&lt;BR /&gt;Can we solve this problem with single block of tabulate script because in my original dataset I have many such columns.</description>
      <pubDate>Wed, 13 May 2020 04:02:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266285#M51860</guid>
      <dc:creator>Rajat</dc:creator>
      <dc:date>2020-05-13T04:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Tabulate by list of column names in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266293#M51861</link>
      <description>&lt;P&gt;Condensing the Tabulate code down to one set of code, would make the code far more complex.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you say you have many more columns, can you explane further?&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 05:39:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266293#M51861</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-13T05:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Tabulate by list of column names in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266308#M51866</link>
      <description>&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt; I have 5 column like Column "Class" and Column "Subject" which can be present in the data or not. Now to tabulate I have to give all permutation of IF conditions and each would have separate tabulate code. It will make code will become too messy.&lt;BR /&gt;Instead if we can do it with single Tabulate function in which we give all the list of columns and it will take only those columns which are available in the data.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 13 May 2020 08:54:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266308#M51866</guid>
      <dc:creator>Rajat</dc:creator>
      <dc:date>2020-05-13T08:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Tabulate by list of column names in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266337#M51874</link>
      <description>&lt;P&gt;Is this what you are looking for???&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=current data table();

// The list of columns to look for
theList={"Class","Student","Subject", "xxxxxx","xxxxxx"};

allColList = dt &amp;lt;&amp;lt; get column names(string);

// Remove any columns from theList that are not in the data table
For(i=n items(theList),i&amp;gt;=1, i--,
	If(n rows(loc(allColList,theList[i]))==0,
		remove from(theList,i,1)
	)
);

// Run the tabulate
Tabulate(
	Show Control Panel( 0 ),
	Add Table(
		Column Table( Analysis Columns( :Marks ), Statistics( Max ) ),
		Row Table( Grouping Columns( eval(theList) ) )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the different target columns play roles other than Grouping Columns, you will need to develop the code accounting for the different required input syntax.&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 10:23:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266337#M51874</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-13T10:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Tabulate by list of column names in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266369#M51878</link>
      <description>Thanks You @tsnelson</description>
      <pubDate>Wed, 13 May 2020 13:06:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Tabulate-by-list-of-column-names-in-JSL/m-p/266369#M51878</guid>
      <dc:creator>Rajat</dc:creator>
      <dc:date>2020-05-13T13:06:54Z</dc:date>
    </item>
  </channel>
</rss>

