After sorting jm by the age column, add a new column, find out the age of the adjacent rows up and down the age is not returned at the same time 1.I try to cycle and feel slow myself.Ask for better methods.Thank you very much!
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Column("new",Numeric,Continuous,Width(8));
dt[1,"age"]=1;
for(i=1,i<=Col Number(1),i++,
if(dt[i,"age"]==dt[i-1,"age"],dt[i,"new"]=0,dt[i,"new"]=1);
);

Note, the script you pasted does not match the script in the screen shot.
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Sort( By( :age ), Order( Ascending ), Replace Table );
dt << New Column("new",Numeric,Continuous,Width(8));
t0 = hptime();
dt[1,"new"]=1;
for(i=2,i<=Col Number(1),i++,
if(dt[i,"age"]==dt[i-1,"age"],dt[i,"new"]=0,dt[i,"new"]=1);
);
t1 = hptime();
dt << New Column("new2",Numeric,Continuous,Width(8));
t2 = hptime();
column(dt, "new2") << set each value(
If(row() == 1, 1,
:age == Lag(:age,1), 0,
//else
1)
);
t3 = hptime();
show(t3-t2, t1-t0); <BR /><BR />//The results will be different each time, but the second method takes less than 50% of the time <BR />//compared to the for loop.<BR />//t3 - t2 = 257; t1 - t0 = 679;<BR /><BR /><BR />