Hi,
How to call a sql stored procedure into SAS Viya 3.5?
I am running below code but it is throwing error.
PROC SQL;
Connect to odbc (datasrc="****"
user ="*****" password = "*******" );
create table t as
select * from connection to odbc
Execute(dbo.stp) by odbc;
Disconnect from odbc;
QUIT;
Error:
Hi,
You are mixing up two SQL Pass-Through techniques: SELECT FROM and EXECUTE. Using EXECUTE is the correct way to call a stored procedure. But running a SELECT on top of that in a single query is syntactically unsupported. In fact you are mixing DDL and DML statements. Getting a result set with EXECUTE is not supported.
A work-around would be to have the STP create a result set and query that table after calling the STP, effectively splitting up the SELECT and EXECUTE statements.
Hope this helps,
-- Jan.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.