Hej SAS folk
Det er lykkedes mig at kalde en stored procedure i en Microsoft SQL database med en parameter, som får proceduren til at eksekvere sin kode.
Fejler proceduren, får jeg en ret intetsigende besked i loggen i SAS. Er der nogen måde man kan programmere i SAS, så man får den egentlige fejlbesked fra SQL vist i SAS?
Jeg benytter denne kode:
PROC SQL;
CONNECT TO odbc as sql (NOPROMPT='DRIVER=SQL Server; SERVER=testsqlsrv1; DATABASE=xxxx');
execute (FjernDatasaetLaas &datasetnavn)
by sql;
DISCONNECT FROM sql;
QUIT;
Mvh
Martin
Hi Martin,
even not stated explicitly, this forum is mainly English written. If you are more comfortable with Scandinavian, try the Regional Groups/SAS Community Nordic.
Have you tried SQLXMSG? Don't think there are any other options as long you wish to call from SAS.
Hi Linus
Thanks for your fast reply and aplogies for not writing in english in the first place. But impressive still that you actually understood the question!
I am not sure how to use the macro variables, because they do not give me any messages in the log. I have implemented them in this way:
PROC SQL;
CONNECT TO odbc as sql (NOPROMPT='DRIVER=SQL Server; SERVER=testsqlsrv1; DATABASE=xxxx');
execute (FjernDatasaetLaas &datasetnavn)
by sql;
DISCONNECT FROM sql;
QUIT;
%put &SQLXMSG;
%put &SQLXRC;
And the log shows:
1 %_eg_hidenotesandsource;
5 %_eg_hidenotesandsource;
31
32 PROC SQL;
33 CONNECT TO odbc as sql (NOPROMPT=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX);
34 execute (FjernDatasaetLaas &datasetnavn)
35 by sql;
NOTE: No data found/modified.
36 DISCONNECT FROM sql;
37 QUIT;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.02 seconds
cpu time 0.00 seconds
38
39 %put &SQLXMSG;
40 %put &SQLXRC;
0
41
42
43 %_eg_hidenotesandsource;
58
59
60 %_eg_hidenotesandsource;
Do you know if my implementation is wrong or if something else is failing?
Best wishes
Martin
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.