Here are 3 of the ways to do this.......other examples could be thought up
Names Default To Here( 1 );
dt = New Table( "Sample",
Add Rows( 24 ),
New Column( "ID1",
Character,
"Nominal",
Set Values(
{"M101", "M101", "M101", "M101", "M101", "M101", "M101", "M101", "M105", "M105", "M105", "M105", "M105",
"M105", "M105", "M105", "M110", "M110", "M110", "M110", "M110", "M110", "M110", "M110"}
)
),
New Column( "MAIN_RAD",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1] )
),
New Column( "SUB_RAD",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3] )
),
New Column( "COUNT1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[1796, 1583, 1521, 1621, 1601, 1539, 1639, 1610, 1601, 1539, 1639, 1610, 1856, 1960, 1931, 2004, 1993, 1779,
1820, 1813, 1813, 1736, 1620, 1643]
)
)
);
// Create the column using a formula
dt << New Column( "By Formula",
Character( 16 ),
"Nominal",
Formula(
If( Row() == 1, flag = 0 );
If( Lag( :ID1 ) != :ID1 | Lag( :MAIN_RAD ) != :MAIN_RAD,
flag = 0
);
If( flag == 0 & Col Max( :COUNT1, :ID1, :MAIN_RAD ) == :COUNT1,
Flag = 1;
"Max";
,
""
);
)
);
// Create the column using JSL
dt << New Column( "Using JSL", character );
For( i = 1, i <= N Rows( dt ), i++,
rowID1 = dt:ID1[i];
rowMain_Rad = dt:MAIN_RAD[i];
sameRows = dt << get rows where( dt:ID1 == rowID1 & dt:MAIN_RAD == rowMain_Rad );
If( Max( dt:Count1[sameRows] ) == :COUNT1[i],
dt:Using JSL[i] = "Max"
);
);
// Create the column using Platforms
dtMax = dt << Summary(
invisible,
Group( :ID1, :MAIN_RAD ),
Max( :COUNT1 ),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" ),
Link to original data table( 0 )
);
dtMax << delete columns( "N Rows" );
dtMax << New Column( "Using Platform", character, set each value( "Max" ) );
dt << Update( With( dtMax ), Match Columns( :ID1 = :ID1, :MAIN_RAD = :MAIN_RAD, :COUNT1 = :COUNT1 ) );
Jim