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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.