Hi all,
How can I write an integer value counter to increment unique values in column B within group A, to do this?
![StumptownSlash_0-1683660565893.png StumptownSlash_0-1683660565893.png](https://community.jmp.com/t5/image/serverpage/image-id/52673i08CF4977974EE8F9/image-size/large?v=v2&px=999)
Here is what I have tried so far:
dt_Table1 = Data Table("Table1");
dt_Table1 << New Column("Dataset", Numeric, "Nominal", Set Selected);
Sum1 = dt_Table1 << Summary(Group(:Group, :Date));
Sum2 = Sum1 << Summary(Group(:Group));
:N Rows << Set Name("N Datasets in Group");
dt_Table1 << Update(
with(Data Table(Sum2)),
Merge Same Name Columns
Match Flag(0),
Suppress foruma evaluation(0),
By Matching Columns(:Group = :Group),
Drop multiples(1, 0),
Include Nonmatches(0, 0),
Preserve main table order(1)
);
dt = dt_Table1;
For(i = 1, i <= :N Rows(dt), i++,
While(Group_Number = GetValue(:Group[i]),
N == Get Value(dt, :N Datasets in Group[i]),
For(j = 1, j <= N, j++,
:Dataset << Set Value == (j),
),
Group_Number = Group_Number + 1,
),
);
Outputs:
![StumptownSlash_0-1683663388740.png StumptownSlash_0-1683663388740.png](https://community.jmp.com/t5/image/serverpage/image-id/52675i958D62029D00F4AE/image-size/large?v=v2&px=999)
![StumptownSlash_0-1683662459921.png StumptownSlash_0-1683662459921.png](https://community.jmp.com/t5/image/serverpage/image-id/52674i11792537E71B27AB/image-size/large?v=v2&px=999)