BookmarkSubscribeRSS Feed
david999
Calcite | Level 5

I'm trying to call a stored procedure on redshift from SAS, and I am running into the below error. Could someone please help me with this?

 

PROC SQL noerrorstop;
connect to SASIORST( READBUFF=10000 DSN=DBSTG USER=sas PASSWORD="******");
create table work.test as
select * from connection to SASIORST
(call mccm.proc_temp);
disconnect from SASIORST;
quit;

 

ERROR: CLI prepare error: [SAS][ODBC Redshift Wire Protocol driver][Redshift]ERROR: syntax error at end of input(Position 20; File
/home/ec2-user/padb/src/pg/src/backend/parser/parser_scan.l; Line 711; Routine yyerror; )
SQL statement: call mccm.proc_temp.

1 REPLY 1
SASKiwi
PROC Star

External database stored procedures have to be run using the EXECUTE statement:

PROC SQL noerrorstop;
connect to SASIORST( READBUFF=10000 DSN=DBSTG USER=sas PASSWORD="******");
execute (call mccm.proc_temp) by SASIORST;
disconnect from SASIORST;
quit;

However you can't read a result set from EXECUTE. If the stored procedure is producing a result set then it needs to be changed so a table or view is created instead. Then this table can be read in a following SELECT statement.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Autotuning Deep Learning Models Using SAS

Follow along as SAS’ Robert Blanchard explains three aspects of autotuning in a deep learning context: globalized search, localized search and an in parallel method using SAS.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1568 views
  • 0 likes
  • 2 in conversation