Two more examples using If(!isempty and my preferred try( method examples:
Names Default To Here( 1 );
// open data table and make some changes
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << set name( "table" ) <<
New Column( "Weight/Height", formula( :weight / :height ) );
// open another data table
dt2 = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt2 << Select where(:sex == "Q");
dt3 = dt2 << Subset(
Selected Rows( 1 ),
Selected columns only( 0 )
);
If(!isempty(dt3), //if selected rows == 0 dt3 is an empty variable
dt4 = dt << Join(
With( dt3 ),
By Matching Columns( :name = :name ),
Drop multiples( 0, 0 ),
Include Nonmatches( 0, 0 ),
Preserve main table order( 1 )), //no table print error log
print("Empty subset table")
);
try(dt4 = dt << Join(
With( dt3 ),
By Matching Columns( :name = :name ),
Drop multiples( 0, 0 ),
Include Nonmatches( 0, 0 ),
Preserve main table order( 1 ))
, //catch expresion
Print("Join Failed"));