<?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: for each group find out which value is missing in a specific column, then create a new row with the missing value for that group with 0 in the count column as a corresponding value for that row in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/for-each-group-find-out-which-value-is-missing-in-a-specific/m-p/684680#M87059</link>
    <description>&lt;P&gt;You could split the data and then stack it again.&lt;/P&gt;&lt;P&gt;If a row is missing in the source table, there will be an empty spot in the split data table - and it will stay empty after stacking.&lt;/P&gt;&lt;P&gt;Therefore you have to replace the missing&amp;nbsp; values with 0 at the end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Sheet1",
	Add Rows( 16 ),
New Column( "Month - Year",
	Numeric,
	Format( "Format Pattern", "&amp;lt;Mmm&amp;gt;-&amp;lt;YYYY&amp;gt;"),
		Input Format( "Format Pattern", "&amp;lt;Mmm&amp;gt;-&amp;lt;YYYY&amp;gt;" ),
		Set Values(	{"Jan-2021", "Jan-2021", "Jan-2021", "Jan-2021", "Jan-2021", "Jan-2021","Jan-2021", "Feb-2021", "Feb-2021", "Feb-2021", "Feb-2021", "Feb-2021","Mrz-2021", "Mrz-2021", "Mrz-2021", "Mrz-2021"})),
	New Column( "State",Character,
		Set Values({"FL", "FL", "FL", "CA", "CA", "CA", "CA", "FL", "FL", "CA", "CA", "CA","FL", "FL", "FL", "FL"})),
	New Column( "Companys",	Character,Set Values({"A", "B", "C", "A", "C", "D", "E", "A", "B", "A", "B", "D", "A", "B","D", "E"})),
	New Column( "Sector",Character,	Set Values(	{"JF", "JF", "DK", "JF", "DK", "DK", "RT", "JF", "JF", "JF", "JF", "DK","JF", "JF", "DK", "RT"})),
	New Column( "Count",Set Values([2, 56, 4, 12, 17, 99, 4, 23, 20, 1, 15, 18,31, 2, 13, 10])));

dtSplit= dt &amp;lt;&amp;lt; Split(
	Split By( :"Month - Year"n ),
	Split( :Count ),
	Group( :Sector, :Companys ),
	Remaining Columns( Drop All ),
	Sort by Column Property
);

dtStacked = dtSplit &amp;lt;&amp;lt;Stack(columns( :"Jan-2021"n, :"Feb-2021"n, :"Mrz-2021"n )
);

dtStacked:Data[Loc(IsMissing(dtStacked[0,"Data"]))]=0

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 06 Oct 2023 20:54:53 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2023-10-06T20:54:53Z</dc:date>
    <item>
      <title>for each group find out which value is missing in a specific column, then create a new row with the missing value for that group with 0 in the count column as a corresponding value for that row</title>
      <link>https://community.jmp.com/t5/Discussions/for-each-group-find-out-which-value-is-missing-in-a-specific/m-p/684651#M87056</link>
      <description>&lt;P&gt;I have 4 columns in the mock data set (File attached below). The column "Companys" is grouped by column "Month-Year" and "State". Each "Companys" column value is associated to a value in column "Sectcor". I want find what values are missing in each group of Month-Year and State Column for example Sector "DK" has Companys "C" and "D" Associated to it but for group Jan-2021, CA we have 2 rows associated to it with Companys "C" and "D" for Sector "DK"&amp;nbsp; but in group Feb-2021, CA there is only one row associated to it&amp;nbsp; with Companys "D" for Setcor "DK". I want to insert the missing row for Companys "C" like&amp;nbsp;Feb-2021, CA, "C" and 0 for the count column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the row in red. Please help with this problem!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 19:51:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/for-each-group-find-out-which-value-is-missing-in-a-specific/m-p/684651#M87056</guid>
      <dc:creator>j0rg</dc:creator>
      <dc:date>2023-10-06T19:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: for each group find out which value is missing in a specific column, then create a new row with the missing value for that group with 0 in the count column as a corresponding value for that row</title>
      <link>https://community.jmp.com/t5/Discussions/for-each-group-find-out-which-value-is-missing-in-a-specific/m-p/684680#M87059</link>
      <description>&lt;P&gt;You could split the data and then stack it again.&lt;/P&gt;&lt;P&gt;If a row is missing in the source table, there will be an empty spot in the split data table - and it will stay empty after stacking.&lt;/P&gt;&lt;P&gt;Therefore you have to replace the missing&amp;nbsp; values with 0 at the end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Sheet1",
	Add Rows( 16 ),
New Column( "Month - Year",
	Numeric,
	Format( "Format Pattern", "&amp;lt;Mmm&amp;gt;-&amp;lt;YYYY&amp;gt;"),
		Input Format( "Format Pattern", "&amp;lt;Mmm&amp;gt;-&amp;lt;YYYY&amp;gt;" ),
		Set Values(	{"Jan-2021", "Jan-2021", "Jan-2021", "Jan-2021", "Jan-2021", "Jan-2021","Jan-2021", "Feb-2021", "Feb-2021", "Feb-2021", "Feb-2021", "Feb-2021","Mrz-2021", "Mrz-2021", "Mrz-2021", "Mrz-2021"})),
	New Column( "State",Character,
		Set Values({"FL", "FL", "FL", "CA", "CA", "CA", "CA", "FL", "FL", "CA", "CA", "CA","FL", "FL", "FL", "FL"})),
	New Column( "Companys",	Character,Set Values({"A", "B", "C", "A", "C", "D", "E", "A", "B", "A", "B", "D", "A", "B","D", "E"})),
	New Column( "Sector",Character,	Set Values(	{"JF", "JF", "DK", "JF", "DK", "DK", "RT", "JF", "JF", "JF", "JF", "DK","JF", "JF", "DK", "RT"})),
	New Column( "Count",Set Values([2, 56, 4, 12, 17, 99, 4, 23, 20, 1, 15, 18,31, 2, 13, 10])));

dtSplit= dt &amp;lt;&amp;lt; Split(
	Split By( :"Month - Year"n ),
	Split( :Count ),
	Group( :Sector, :Companys ),
	Remaining Columns( Drop All ),
	Sort by Column Property
);

dtStacked = dtSplit &amp;lt;&amp;lt;Stack(columns( :"Jan-2021"n, :"Feb-2021"n, :"Mrz-2021"n )
);

dtStacked:Data[Loc(IsMissing(dtStacked[0,"Data"]))]=0

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Oct 2023 20:54:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/for-each-group-find-out-which-value-is-missing-in-a-specific/m-p/684680#M87059</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-10-06T20:54:53Z</dc:date>
    </item>
  </channel>
</rss>

