Here is a script that runs against a sample data table that creates an ID column with a formula as you want
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\cars.jmp" );
dt << New Column( "ID",
formula(
If( Row() == 1,
Summarize( drugs = by( :Make ) )
);
Contains( drugs, :Make );
)
);
Jim