I'm trying to understand how the whereTable paramater in CAS actions works in detail.
Why would the whereTable parameter be used instead of using the WHERE expression? what are the possible limitations of using the whereTable parameter and how does it operate specifically? There isn't detailed information about whereTable in the Help center documentation.
It's a way to filter rows of a table based on values of like variables in another table.
data casuser.baseball;
set sashelp.baseball;
run;
data casuser.where_table1;
set sashelp.baseball;
where team='Montreal';
keep team Name;
run;
data casuser.where_table2;
set sashelp.baseball;
where nhits >= 100;
keep name team nhits;
run;
proc cas;
table.copyTable /
casout={caslib="casuser", name="baseball_montreal", replace=TRUE},
table={caslib="casuser", name="baseball", whereTable={caslib="casuser" name="where_table1"}};
table.copyTable /
casout={caslib="casuser", name="baseball_nhits", replace=TRUE},
table={caslib="casuser", name="baseball", whereTable={caslib="casuser" name="where_table2"}};
table.fetch / table="baseball_montreal";
table.fetch / table="baseball_nhits";
quit;
You're right, though, the doc is light on the details, but I did find this one example with some explanation:
SAS Help Center: Filter Multiple Input Tables Based on Values in a whereTable
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.