<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Return a message from a SQL Server stored procedure to the SAS log in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Return-a-message-from-a-SQL-Server-stored-procedure-to-the-SAS/m-p/588883#M168357</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I tried a simple proc print in EG and it behaved as expected - 0 return code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=sashelp.class (obs=1);
run;
%put &amp;amp;=syscc;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Could it be not having an output destination open is causing your warning?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;But my original questions remain, and in summary:&amp;nbsp; Why does a simple PRINT statement cause a WARNING in SAS?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The PRINT statement in SQL Server, not PROC PRINT in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have permission to create a stored procedure in your environment, do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CREATE  PROCEDURE dbo.spHelloWorld
AS
BEGIN
    SET NOCOUNT ON
    PRINT 'Hello World'
END
GO&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then in SAS:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname foo odbc "library details pointing to your SP";

proc sql;
   connect using foo;
   execute by foo;
EXEC dbo.spHelloWorld
   );
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then ask yourself "Why is this a WARNING?"&amp;nbsp; What possibly causes SAS to think this is a warning rather than a note?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 15 Sep 2019 21:32:01 GMT</pubDate>
    <dc:creator>ScottBass</dc:creator>
    <dc:date>2019-09-15T21:32:01Z</dc:date>
    <item>
      <title>Return a message from a SQL Server stored procedure to the SAS log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Return-a-message-from-a-SQL-Server-stored-procedure-to-the-SAS/m-p/588415#M168159</link>
      <description>&lt;P&gt;I have this stored procedure:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CREATE OR ALTER PROCEDURE dbo.spGetMaxRldxAuditKey
(
	@reference_rldx_audit_key INT
)
AS
BEGIN
    SET NOCOUNT ON

    DECLARE @max_rldx_audit_key INT

    -- get max rldx_audit_key
    SET @max_rldx_audit_key = (
        SELECT MAX(rldx_audit_key) AS max_rldx_audit_key
          FROM (
              SELECT TOP 1 rldx_audit_key
                FROM dmt.PUB_FLAT
              UNION ALL
              SELECT TOP 1 rldx_audit_key
                FROM dmt.PVT_FLAT
              UNION ALL
              SELECT TOP 1 rldx_audit_key
                FROM dmt.PHI_FLAT
          ) x
    )
          
    -- if the reference rldx_audit_key = max rldx_audit_key raise a message
    -- else raise an error
    IF @reference_rldx_audit_key = @max_rldx_audit_key
    BEGIN
        RAISERROR('Reference rldx_audit_key matches max rldx_audit_key',0,1)
    END
    ELSE
    BEGIN
        RAISERROR('Reference rldx_audit_key does not match max rldx_audit_key',16,1)
    END 
END
GO
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This works just fine in SQL Server Management Studio:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;EXEC dbo.spGetMaxRldxAuditKey 51  -- valid
EXEC dbo.spGetMaxRldxAuditKey 49  -- invalid
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The first invocation displays a message in the Messages window, and the Query executed successfully.&lt;/P&gt;
&lt;P&gt;The second invocation displays a red message in the Messages window, and the Query completed with errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The business logic is the&amp;nbsp;@reference_rldx_audit_key is derived in SAS from reading a header file.&amp;nbsp; The source data must match the key in the header file.&amp;nbsp; There is a match if the reference_rldx_audit_key matches the maximum rldx_audit_key across the three source tables.&amp;nbsp; The rldx_audit_key has the same value within a given source table, so SELECT TOP 1 is used for performance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when I invoke this in SAS:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* test the stored procedure ;

%let syscc=0;

* valid ;
%let header_rldx_audit_key=51;

proc sql noprint;
   connect using rldx;
   execute by    rldx (
EXEC dbo.spGetMaxRldxAuditKey &amp;amp;header_rldx_audit_key
   );
   %put &amp;amp;=sqlxrc;
   %put &amp;amp;=sqlxmsg;
quit;

%put &amp;amp;=syscc;

* invalid ;
%let header_rldx_audit_key=49;

proc sql noprint;
   connect using rldx;
   execute by    rldx (
EXEC dbo.spGetMaxRldxAuditKey &amp;amp;header_rldx_audit_key
   );
   %put &amp;amp;=sqlxrc;
   %put &amp;amp;=sqlxmsg;
quit;

%put &amp;amp;=syscc;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I get this in the SAS log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;27         %let syscc=0;
28         
29         * valid ;
30         %let header_rldx_audit_key=51;
31         
32         proc sql noprint;
33            connect using rldx;
ODBC: AUTOCOMMIT is YES for connection 1
34            execute by    rldx (
35         EXEC dbo.spGetMaxRldxAuditKey &amp;amp;header_rldx_audit_key
36            );
 
ODBC_17: Executed: on connection 1
EXEC dbo.spGetMaxRldxAuditKey 51
 
WARNING: During execute: [Microsoft][SQL Server Native Client 10.0][SQL Server]Reference rldx_audit_key matches max 
         rldx_audit_key
37            %put &amp;amp;=sqlxrc;
SQLXRC=01000
38            %put &amp;amp;=sqlxmsg;
2 The SAS System                                                                        10:53 Friday, September 13, 2019

SQLXMSG=[Microsoft][SQL Server Native Client 10.0][SQL Server]Reference rldx_audit_key matches max rldx_audit_key
39         quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.01 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              102.78k
      OS Memory           12836.00k
      Timestamp           13/09/2019 11:24:50 AM
      

40         
41         %put &amp;amp;=syscc;
SYSCC=4
42         
43         * invalid ;
44         %let header_rldx_audit_key=49;
45         
46         proc sql noprint;
47            connect using rldx;
ODBC: AUTOCOMMIT is YES for connection 1
48            execute by    rldx (
49         EXEC dbo.spGetMaxRldxAuditKey &amp;amp;header_rldx_audit_key
50            );
 
ODBC_18: Executed: on connection 1
EXEC dbo.spGetMaxRldxAuditKey 49
 
ERROR: CLI execute error: [Microsoft][SQL Server Native Client 10.0][SQL Server]Reference rldx_audit_key does not match 
       max rldx_audit_key
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
51            %put &amp;amp;=sqlxrc;
SQLXRC=42000
52            %put &amp;amp;=sqlxmsg;
SQLXMSG=[Microsoft][SQL Server Native Client 10.0][SQL Server]Reference rldx_audit_key does not match max rldx_audit_key
53         quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              101.87k
      OS Memory           12836.00k
      Timestamp           13/09/2019 11:24:50 AM
      
54         
55         %put &amp;amp;=syscc;
SYSCC=1012&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My problem is with the first WARNING.&amp;nbsp; I need it to be either a NOTE, or simply a message returned by SQL Server and displayed in the SAS log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, I'm raising an error you say (even if it does have severity level = 0).&amp;nbsp; Ok, so I tried changing it to a PRINT statement for the valid scenario.&amp;nbsp; Then I tried simply PRINT ''.&amp;nbsp; No joy.&amp;nbsp; It's as though if I return ANY message via the stored procedure, SAS treats it as a warning (or error if I use RAISERROR with severity level=16).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even this stored procedure generates a warning in SAS:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CREATE OR ALTER PROCEDURE dbo.spSasIsBuggy 
AS
BEGIN
    SET NOCOUNT ON
    PRINT 'SAS is buggy'
END
GO&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
   connect using rldx;
   execute by    rldx (
EXEC dbo.spSasIsBuggy
   );
   %put &amp;amp;=sqlxrc;
   %put &amp;amp;=sqlxmsg;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;27         proc sql noprint;
28            connect using rldx;
ODBC: AUTOCOMMIT is YES for connection 1
29            execute by    rldx (
30         EXEC dbo.spSasIsBuggy
31            );
 
ODBC_20: Executed: on connection 1
EXEC dbo.spSasIsBuggy
 
WARNING: During execute: [Microsoft][SQL Server Native Client 10.0][SQL Server]SAS is buggy
32            %put &amp;amp;=sqlxrc;
SQLXRC=01000
33            %put &amp;amp;=sqlxmsg;
SQLXMSG=[Microsoft][SQL Server Native Client 10.0][SQL Server]SAS is buggy
34         quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone know if this is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) a shortcoming in the SQL Server ODBC driver from Microsoft?&amp;nbsp; Or&lt;/P&gt;
&lt;P&gt;2) a shortcoming/design bug in how SAS's ODBC engine interprets a message returned from the ODBC driver?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, any ideas re: workarounds?&amp;nbsp; I'm aware of a few klunky approaches, but I would like to encapsulate the logic in the SP if possible, and just have SAS generate an error when an error occurs, and not a warning when no error occurs.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suppose I can just comment out the valid condition, and not return any confirmation message to the end user, but IMO that's not ideal.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2019 01:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Return-a-message-from-a-SQL-Server-stored-procedure-to-the-SAS/m-p/588415#M168159</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-09-13T01:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Return a message from a SQL Server stored procedure to the SAS log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Return-a-message-from-a-SQL-Server-stored-procedure-to-the-SAS/m-p/588422#M168163</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15043"&gt;@ScottBass&lt;/a&gt;&amp;nbsp; - A couple of ideas:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;How about trying - select * from connection using rldx (exec MyProc) - does it return your error messages?&lt;/LI&gt;
&lt;LI&gt;How about creating a temporary table in SQL Server containing the error message / return code after executing the proc? I've used this myself and it looks like this -&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;execute(&lt;/P&gt;
&lt;P&gt;if object_id('tempdb..#MyReturnCode') is not null drop table #MyReturnCode;&lt;BR /&gt;create table #MyReturnCode (RetCode int);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EXEC MyProc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;INSERT INTO #MyReturnCode values (@RetCode).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After doing this you can do a normal select connection to get the message into SAS&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2019 02:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Return-a-message-from-a-SQL-Server-stored-procedure-to-the-SAS/m-p/588422#M168163</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-09-13T02:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: Return a message from a SQL Server stored procedure to the SAS log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Return-a-message-from-a-SQL-Server-stored-procedure-to-the-SAS/m-p/588428#M168168</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought I might hear from you :).&amp;nbsp; I saw some of your previous answers on similar subjects before posting my question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;How about trying - select * from connection using rldx (exec MyProc) - does it return your error messages?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No since my RAISERROR messages aren't a result set, although the 2nd one does result in a (desired) error in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;How about creating a temporary table in SQL Server containing the error message / return code after executing the proc? I've used this myself and it looks like this&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I'm running with right now is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Version 1:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;SQL Server Inline table-valued function (TVF) (this could easily be a view as well):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CREATE OR ALTER FUNCTION dbo.fnGetMaxRldxAuditKey ()
RETURNS TABLE
    RETURN (
        SELECT MAX(rldx_audit_key) AS max_rldx_audit_key
          FROM (
              SELECT TOP 1 rldx_audit_key
                FROM dmt.PUB_FLAT
              UNION ALL
              SELECT TOP 1 rldx_audit_key
                FROM dmt.PVT_FLAT
              UNION ALL
              SELECT TOP 1 rldx_audit_key
                FROM dmt.PHI_FLAT
          ) x
    )
GO&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SAS Invocation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let syscc=0;

%macro CheckRldxAuditKey(
   reference_rldx_audit_key
);
proc sql noprint;
   connect using rldx;
   select max_rldx_audit_key
   into :max_rldx_audit_key trimmed
   from connection to rldx (
SELECT max_rldx_audit_key FROM dbo.fnGetMaxRldxAuditKey()
   );
quit;

%if (&amp;amp;max_rldx_audit_key eq &amp;amp;reference_rldx_audit_key) %then %do;
   %put %str(NO)TE: max_rldx_audit_key matches header rldx_audit_key.;
%end;
%else %do;
   %put %str(ERR)OR: max_rldx_audit_key does not match header rldx_audit_key.;
   %let syscc=8;
   %abort cancel;
%end;
%mend;

* valid ;
%let header_rldx_audit_key=51;
%CheckRldxAuditKey(&amp;amp;header_rldx_audit_key)
%put &amp;amp;=syscc;

proc print data=sashelp.class (obs=1);
run;

* invalid ;
%let header_rldx_audit_key=49;
%CheckRldxAuditKey(&amp;amp;header_rldx_audit_key)

* does not execute due to %abort cancel ;
%put &amp;amp;=syscc;

proc print data=sashelp.class (obs=1);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;U&gt;Version 2:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;SQL Server Scalar-valued function:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CREATE OR ALTER FUNCTION dbo.fnCheckRldxAuditKey (
    @reference_rldx_audit_key INT
)
RETURNS BIT AS
BEGIN
    DECLARE @max_rldx_audit_key INT
    SET @max_rldx_audit_key = (
        SELECT MAX(rldx_audit_key) AS max_rldx_audit_key
          FROM (
              SELECT TOP 1 rldx_audit_key
                FROM dmt.PUB_FLAT
              UNION ALL
              SELECT TOP 1 rldx_audit_key
                FROM dmt.PVT_FLAT
              UNION ALL
              SELECT TOP 1 rldx_audit_key
                FROM dmt.PHI_FLAT
          ) x
    )
    RETURN IIF(@max_rldx_audit_key = @reference_rldx_audit_key,1,0)
END
GO
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SAS Invocation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro CheckRldxAuditKey(
   reference_rldx_audit_key
);
%local rc;&lt;BR /&gt;%let rc=0;  %* initialize to 0 in case SQL fails for some reason ;
proc sql noprint;
   connect using rldx;
   select *
   into :rc trimmed
   from connection to rldx (
SELECT dbo.fn_CheckRldxAuditKey(&amp;amp;reference_rldx_audit_key)
   );
quit;

%if (&amp;amp;rc eq 1) %then %do;
   %put %str(NO)TE: max_rldx_audit_key matches header rldx_audit_key.;
%end;
%else %do;
   %put %str(ERR)OR: max_rldx_audit_key does not match header rldx_audit_key.;
   %let syscc=8;
   %abort cancel;
%end;
%mend;

* valid ;
%let header_rldx_audit_key=51;
%CheckRldxAuditKey(&amp;amp;header_rldx_audit_key)
%put &amp;amp;=syscc;

proc print data=sashelp.class (obs=1);
run;

* invalid ;
%let header_rldx_audit_key=49;
%CheckRldxAuditKey(&amp;amp;header_rldx_audit_key)

* does not execute due to %abort cancel, which is what I want ;
%put &amp;amp;=syscc;

proc print data=sashelp.class (obs=19);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Neither approach has performance concerns, so I'll probably go with Version 2.&amp;nbsp; But I have to embed unwanted logic in a macro.&amp;nbsp; If I bailed on providing a success message to the end user then my original approach using a SP would work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But my original questions remain, and in summary:&amp;nbsp; Why does a simple PRINT statement cause a WARNING in SAS?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm hoping a little birdie may chime in.&amp;nbsp; I'd open a TS ticket but I'm not getting joy from my local TS lately.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2019 06:25:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Return-a-message-from-a-SQL-Server-stored-procedure-to-the-SAS/m-p/588428#M168168</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-09-13T06:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: Return a message from a SQL Server stored procedure to the SAS log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Return-a-message-from-a-SQL-Server-stored-procedure-to-the-SAS/m-p/588692#M168280</link>
      <description>&lt;P&gt;I tried a simple proc print in EG and it behaved as expected - 0 return code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=sashelp.class (obs=1);
run;
%put &amp;amp;=syscc;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Could it be not having an output destination open is causing your warning?&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2019 02:26:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Return-a-message-from-a-SQL-Server-stored-procedure-to-the-SAS/m-p/588692#M168280</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-09-14T02:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Return a message from a SQL Server stored procedure to the SAS log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Return-a-message-from-a-SQL-Server-stored-procedure-to-the-SAS/m-p/588883#M168357</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I tried a simple proc print in EG and it behaved as expected - 0 return code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=sashelp.class (obs=1);
run;
%put &amp;amp;=syscc;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Could it be not having an output destination open is causing your warning?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;But my original questions remain, and in summary:&amp;nbsp; Why does a simple PRINT statement cause a WARNING in SAS?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The PRINT statement in SQL Server, not PROC PRINT in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have permission to create a stored procedure in your environment, do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CREATE  PROCEDURE dbo.spHelloWorld
AS
BEGIN
    SET NOCOUNT ON
    PRINT 'Hello World'
END
GO&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then in SAS:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname foo odbc "library details pointing to your SP";

proc sql;
   connect using foo;
   execute by foo;
EXEC dbo.spHelloWorld
   );
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then ask yourself "Why is this a WARNING?"&amp;nbsp; What possibly causes SAS to think this is a warning rather than a note?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Sep 2019 21:32:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Return-a-message-from-a-SQL-Server-stored-procedure-to-the-SAS/m-p/588883#M168357</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-09-15T21:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Return a message from a SQL Server stored procedure to the SAS log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Return-a-message-from-a-SQL-Server-stored-procedure-to-the-SAS/m-p/590684#M169105</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15043"&gt;@ScottBass&lt;/a&gt; - Unfortunately I can't test your stored procedure as I don't have the required permissions &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Sep 2019 01:52:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Return-a-message-from-a-SQL-Server-stored-procedure-to-the-SAS/m-p/590684#M169105</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-09-22T01:52:20Z</dc:date>
    </item>
  </channel>
</rss>

