Where does the extra semi-colon come from. It's not in the code as posted.
And because I "stumbled" over the code while doing something else here the logic to derive a DB schema name from a SAS library definition (code for SAS libref myora as per your sample code).
proc sql noprint;
select sysvalue into :ora_schema trimmed
from dictionary.libnames
where
libname="%upcase(myora)"
and sysname='Schema/Owner'
;
quit;
proc sql;
connect using myora;
create table want as
select * from connection to myora
(
SELECT *
FROM &ora_schema..fact_ope_form
limit 10000;
)
;
disconnect from myora;
quit;
IF you've got already a SAS library defined that points to your Oracle schema then I'd be using the connect using syntax as it avoids passing explicit connection info in code - especially credentials. If there isn't such a pre-assigned SAS library then ideally use an authentication domain instead of explicit credentials.
If developing explicit pass-through SQL I normally use a two step approach:
1. First develop the DB specific pass-through SQL syntax using a DB client (i.e. SQL Developer).
2. Once DB SQL fully working "wrap" SAS around it.
If you want help discovering the connection details for an existing libref you can use this macro:
https://github.com/sasutils/macros/blob/master/dblibchk.sas
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.