<?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: proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412253#M279833</link>
    <description>&lt;P&gt;You can use the resolve() function and the %put macro statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table test as
select
  name,
  weight,
  case
    when age &amp;gt; 11 then '1'
    else resolve('%put error!;')
  end as test
from sashelp.class;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Nov 2017 09:38:24 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-11-10T09:38:24Z</dc:date>
    <item>
      <title>proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412245#M279832</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While using case when statement in proc sql. when it doesn't satisfy the case when statement. I need to throw a UNOTE in log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance,&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 08:47:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412245#M279832</guid>
      <dc:creator>Sabharish</dc:creator>
      <dc:date>2017-11-10T08:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412253#M279833</link>
      <description>&lt;P&gt;You can use the resolve() function and the %put macro statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table test as
select
  name,
  weight,
  case
    when age &amp;gt; 11 then '1'
    else resolve('%put error!;')
  end as test
from sashelp.class;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 09:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412253#M279833</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-11-10T09:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412254#M279834</link>
      <description>&lt;P&gt;There isn't (as far as I can figure out) a way to put text out to the log.&amp;nbsp; This is because the SQL parser is a separate entity from the Base SAS system, so the function like put is not available.&amp;nbsp; I would put a step like this after your SQL:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set &amp;lt;yourdata&amp;gt; (where=(VAR not in (&amp;lt;list of valid values)) obs=1;
  put UNOTE: Incorrect value found;
run;&lt;/PRE&gt;
&lt;P&gt;Not tested, so you would need to fiddle around, but basically the data null should read 1 record from the data where the list is not in the prescribed list, and if there is one record then put the log message out.&amp;nbsp; Or you could simply do your processing in a datastep straight up, no&amp;nbsp;&lt;STRONG&gt;need&lt;/STRONG&gt; to use SQL.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 09:41:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412254#M279834</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-11-10T09:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412257#M279835</link>
      <description>Thanks for the quick response.&lt;BR /&gt;&lt;BR /&gt;But i need a resemblance code in proc sql for the below data step.&lt;BR /&gt;&lt;BR /&gt;is this feasible.&lt;BR /&gt;&lt;BR /&gt;data test;&lt;BR /&gt;set sashelp.class;&lt;BR /&gt;if age&amp;gt;11 then test='1';&lt;BR /&gt;else put 'UNOTE:' age 'less than or equal to 11';&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;thanks in advance</description>
      <pubDate>Fri, 10 Nov 2017 09:51:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412257#M279835</guid>
      <dc:creator>Sabharish</dc:creator>
      <dc:date>2017-11-10T09:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412258#M279836</link>
      <description>&lt;P&gt;Just expand the argument for the resolve function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table test as
select
  name,
  weight,
  case
    when age &amp;gt; 11 then '1'
    else resolve('%put UNOTE: ' !! strip(put(age,best.)) !! ' less than or equal to 11;')
  end as test
from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Nov 2017 09:55:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412258#M279836</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-11-10T09:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412261#M279837</link>
      <description>&lt;P&gt;You know what the funny thing is?&lt;/P&gt;
&lt;P&gt;Until today, I had no idea that something like the resolve() function exists. But I read &lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/PROC-SQL-NOPRINT-and-RESOLVE-function/m-p/412232" target="_blank"&gt;this&lt;/A&gt; topic (just three posts down from yours on the "All Topics" list), and there found a reference to resolve(), which made me investigate further.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 10:04:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412261#M279837</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-11-10T10:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412269#M279838</link>
      <description>&lt;P&gt;I do have to ask why.&amp;nbsp; There is one, and only one reason why you would need to use SQL, and that is if you are passing the SQL code through to a database.&amp;nbsp; If that is the case then you would not be able to use SAS functionality anyways.&amp;nbsp; So your question does not make sense.&amp;nbsp; Use SAS, for which you already have the code written.&amp;nbsp; There is no reason to change it to SQL, and then put in place - what frankly is another really bad use of the macro processor.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 10:27:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/412269#M279838</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-11-10T10:27:02Z</dc:date>
    </item>
  </channel>
</rss>

