Here's an example, that should work.
It queries two tables from JMP sample tables, and joins them afterwards.
As others mentioned, there may be some issues for troubleshooting, probably you can find something in the log
- the referenced table needs to be saved
- the referenced table needs to have no duplicates
- are the references (table name, column name) correct?
- ...
The keys on both sides needs to be saturated with color, and not pale. Pale means not working.
I had some trouble with it, too, but it works.
Names Default To Here( 1 );
Clear Log();
dt_filter = New SQL Query(
Version( 130 ),
Connection( "JMP" ),
JMP Tables( ["Big Class" => "\C:\Program Files\SAS\JMPPRO\15\Samples\Data\Big Class.jmp"] ),
QueryName( "filter" ),
CustomSQL( "SELECT distinct t1.name, t1.age, t1.sex, t1.weight, t1.height FROM \!"Big Class\!" t1 where t1.sex = 'M' and t1.age<=13;" )
) << Run;
Summarize( name_lst = by( dt_filter:name ) );
dt_filter:name << set property("Link ID", 1);
dt_filter << save("$TEMP\dt_filter.jmp");
Assign(
custom_sql,
"\[
SELECT t1.picture, t1.name, t1."sibling ages",
t1.sports, t1."countries visited", t1."family cars", t1."reported illnesses",
t1."age vector"
FROM "Big Class Families" t1
where t1.name in __NAMELIST__
;
]\"
);
Substitute Into( custom_sql, "__NAMELIST__", Substitute( Char( name_lst ), "{", "(", "}", ")" ) );
dt_result = New SQL Query( Version( 130 ), Connection( "JMP" ),
, JMP Tables( ["Big Class Families" => "\C:\Program Files\SAS\JMPPRO\15\Samples\Data\Big Class Families.jmp"] ),
QueryName( "dt_result" ), CustomSQL( custom_sql ) )
<< Run;
dt_result << save("$TEMP\dt_result.jmp");
dt_result:name << set property("Link Reference", Reference Table("$TEMP\dt_filter.jmp"));
Georg