I have a data table with 3 columns

I need to create a table showing % of missing data in the HEIGHT column grouped by ID and SUB_ID. In the case above the result should be:

But it is possible in some cases that there are no rows with missing data. In that case Percent Missing should be 0.

I need help in writing a JSL script for this. I will appreciate any guidance. I have three issues in my script below:
1. How can I track handle/reference to a data table so that I can recall it any time. I have always used "dt = CurrentDataTable" in the beginning of the script. But after having created few summary tables/ subset tables, I lose reference to the original table and don't know how to make it current.
2. I need this to work even when there are no missing rows. Right now script just stops in the middle.
3. I need all tables to close except the final table with Percent Missing.
// Read the original table
dt = CurrentDataTable();
main_table = Data Table( dt ) << get name; // get the table name
// Create a summary table with no of rows grouped by ID and SUB_ID
dt_summary = dt<< Summary(Group(:ID, :SUB_ID), Freq("None"), Weight("None"), output table name( "Main Table Summary"));
:N Rows << Set Name( "Total No of Rows" );
// Create a subset of the original table with only the missing rows
Current Data Table(Data Table(main_table));
dt = CurrentDataTable();
dt_missing = dt << select where( Is Missing( :HEIGHT ) == 1 ) << Subset(Output Table Name("Missing Rows"));
If( !Is Empty( dt_missing ),
dt_missing_summary = Data Table( dt_missing ) << Summary(
Group( :ID, :SUB_ID ),Freq("None"), Weight("None"), output table name( "Missing Rows Table Summary"));
:N Rows << Set Name( "No of Rows with Missing Data" );
dt_missing_summary << Update(
With( Data Table( dt_summary ) ),
Match Columns( :ID = ID, :SUB_ID = :SUB_ID ),
Add Columns from Update table( :Total No of Rows )
);
New Column( "PercentMissing",
Numeric,
"Continuous",
Format( "Percent", 12, 2 ),
Formula( :No of Rows with Missing Data / :Total No of Rows )
);
);
//Close( dt_missing, nosave );
//Close( dt_summary, nosave );Thanks