The `fedSql.execDirect` action submits a SAS FedSQL language statement for immediate execution on the CAS server. It enables standard SQL operations such as selecting, joining, and aggregating data distributed across CAS tables. This action supports advanced optimization controls, giving developers the ability to view query plans (`showPlan`) and execution stages (`showStages`), or to enforce specific execution behaviors like full pass-through.
| Parameter | Description |
|---|---|
| query | Specifies the SAS FedSQL language statement to execute. This is the only required parameter. |
| cntl | Specifies a list of optional control parameters to tune query optimization (e.g., `disablePassThrough`, `preserveJoinOrder`). |
| method | When set to True, prints a brief description of the FedSQL query plan to the log. |
| showPlan | When set to True, prints an XML tree representing the detailed FedSQL query plan. |
| showStages | When set to True, prints a brief description of query plans along with detailed execution stage information. |
| validateOnly | When set to True, validates the query syntax and checks for errors without executing the statement. |
Generate a sample CAS table named 'Cars' for the SQL examples.
| 1 | |
| 2 | PROC CAS; |
| 3 | dataStep.runCode / code=" |
| 4 | data casuser.cars; |
| 5 | set sashelp.cars; |
| 6 | |
| 7 | run; |
| 8 | "; |
| 9 | |
| 10 | RUN; |
| 11 |
Selects specific columns (Make, Model) from the Cars table where the Origin is 'Asia'.
| 1 | |
| 2 | PROC CAS; |
| 3 | fedSql.execDirect / query="select Make, Model from casuser.cars where Origin='Asia'"; |
| 4 | |
| 5 | RUN; |
| 6 |
Calculates the average MSRP by Make, while enabling the display of the execution plan and stages to analyze performance.
| 1 | |
| 2 | PROC CAS; |
| 3 | fedSql.execDirect / query="select Make, avg(MSRP) as AvgPrice from casuser.cars group by Make" showPlan=true showStages=true; |
| 4 | |
| 5 | RUN; |
| 6 |