have you tried dt = bla bla bla where bla bla bla is the query ?
e.g.
New SQL Query(
Version( 130 ),
Connection( "JMP" ),
JMP Tables(
["Montgomery battery life ANOVA example" =>
"\C:\Users\Pega-MAC\Downloads\Montgomery battery life ANOVA example.jmp"]
),
QueryName( "SQLQuery1" ),
Select(
Column( "Material type", "t1", Analysis Type( "Nominal" ) ),
Column( "Temperature", "t1", Analysis Type( "Nominal" ) ),
Column( "Life (in hours)", "t1" )
),
From( Table( "Montgomery battery life ANOVA example", Alias( "t1" ) ) )
) << Run;
where New SQL Query ... was gotten from the source script attached to the output data table.
-Dave