<?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: Sum values in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Sum-values/m-p/257286#M50557</link>
    <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;The last part helped as I could use it to sum portions of the 3000.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I have to figure out how to add a column with a time element such that it changes when&amp;nbsp;&lt;/P&gt;&lt;P&gt;values=shape(values,nrows(values)/3)`;// transpose after reshape&amp;nbsp; is different.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Apr 2020 15:24:13 GMT</pubDate>
    <dc:creator>UberBock</dc:creator>
    <dc:date>2020-04-10T15:24:13Z</dc:date>
    <item>
      <title>Sum values</title>
      <link>https://community.jmp.com/t5/Discussions/Sum-values/m-p/256629#M50420</link>
      <description>&lt;P&gt;I have a column that has 3000 values.&amp;nbsp; I'd like to use a script to create another table that has values 1-5 from the original table summed and then 6-10 summed and so on.&amp;nbsp; So the new table would have 600 values since each value is the summation of 5 values from the original table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 20:44:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sum-values/m-p/256629#M50420</guid>
      <dc:creator>UberBock</dc:creator>
      <dc:date>2020-04-07T20:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Sum values</title>
      <link>https://community.jmp.com/t5/Discussions/Sum-values/m-p/256637#M50422</link>
      <description>&lt;P&gt;Create a new column.&amp;nbsp; Go to the Column Info for the column.&amp;nbsp; Click on the Initialize Data down arrow and select "Sequence Data".&amp;nbsp; Change the Repeat each value N times to 5&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="col.PNG" style="width: 439px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/22850i04024B9EE35E18CB/image-size/large?v=v2&amp;amp;px=999" role="button" title="col.PNG" alt="col.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Click on OK and the new column will be created.&amp;nbsp; Next go to&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; Tables==&amp;gt;Summary&lt;/P&gt;
&lt;P&gt;pull down menu.&amp;nbsp; Choose your columns that you want Summed, and place then in the statistics selection box, and take the new column just added and place it in the Group selection box.&amp;nbsp; Click on OK and it will create the new data table you are asking for.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 20:56:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sum-values/m-p/256637#M50422</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-04-07T20:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sum values</title>
      <link>https://community.jmp.com/t5/Discussions/Sum-values/m-p/256643#M50423</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp; &amp;nbsp;That did did provide the change in the data that&amp;nbsp; I needed.&amp;nbsp; I there a way to put this into a script?&amp;nbsp; I intend to use it with a SQL query that gets the data for may different samples.&amp;nbsp; Each will have these 3000 values.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 21:17:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sum-values/m-p/256643#M50423</guid>
      <dc:creator>UberBock</dc:creator>
      <dc:date>2020-04-07T21:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Sum values</title>
      <link>https://community.jmp.com/t5/Discussions/Sum-values/m-p/256685#M50432</link>
      <description>&lt;P&gt;slightly different approach. (smaller example table, adjust as needed.)&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=New Table( "Untitled 4",
	Add Rows( 12 ),
	New Column( "data",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [1, 2, 3, 10, 20, 30, 100, 200, 300, 1000, 2000, 3000] )
	)
);

values=dt:data&amp;lt;&amp;lt;getvalues;// [1, 2, 3, 10, 20, 30, 100, 200, 300, 1000, 2000, 3000]
values=shape(values,nrows(values)/3)`;// transpose after reshape
values=vsum(values)`; // transpose after summing columns
newtable=astable(values);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The shape() function converts the 12x1 matrix to a 4x3, then transpose to 3x4. Vsum() does a vertical sum of the columns, leaving a 1x4, which is transposed back to a 4x1. Astable() makes a data table from that with 4 rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using Jim's approach, you could build the grouping column like this (using table above):&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt&amp;lt;&amp;lt;newcolumn("group",numeric,values(ceiling((1::12)/3)`));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then grab the summary script from the source script in a manually created table.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 06:24:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sum-values/m-p/256685#M50432</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2020-04-08T06:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Sum values</title>
      <link>https://community.jmp.com/t5/Discussions/Sum-values/m-p/257286#M50557</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;The last part helped as I could use it to sum portions of the 3000.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I have to figure out how to add a column with a time element such that it changes when&amp;nbsp;&lt;/P&gt;&lt;P&gt;values=shape(values,nrows(values)/3)`;// transpose after reshape&amp;nbsp; is different.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2020 15:24:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Sum-values/m-p/257286#M50557</guid>
      <dc:creator>UberBock</dc:creator>
      <dc:date>2020-04-10T15:24:13Z</dc:date>
    </item>
  </channel>
</rss>

