<?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: Why won't this PROC SQL work in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Why-won-t-this-PROC-SQL-work/m-p/16951#M3170</link>
    <description>Hi &lt;BR /&gt;
&lt;BR /&gt;
You're using pass-through SQL so the SQL syntax must be in the DB2 flavor.&lt;BR /&gt;
&lt;BR /&gt;
I believe your where clause is not valid DB2 SQL syntax. I would expect it to look something like:&lt;BR /&gt;
&lt;BR /&gt;
WHERE&lt;BR /&gt;
cu.last_change_dt = date('2011-05-31') AND&lt;BR /&gt;
cuacma.last_change_dt = date('2011-05-31') AND&lt;BR /&gt;
acmapo.last_change_dt = date('2011-05-31') AND&lt;BR /&gt;
empo.last_change_dt = date('2011-05-31') AND&lt;BR /&gt;
....&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
    <pubDate>Mon, 20 Jun 2011 04:02:22 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2011-06-20T04:02:22Z</dc:date>
    <item>
      <title>Why won't this PROC SQL work</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-won-t-this-PROC-SQL-work/m-p/16948#M3167</link>
      <description>Hello, I am hoping some can answer this question for me.  I have the PROC sql code and running it on REMOTE sas.  I was given the code from someone who uses WINSQL.  But as soon as I remote submit it, it just comes back with not results and really no log.  Can someone please help. I am more a SAS DATA step person so sql code is not my specialty.  Thanks so much in advance.&lt;BR /&gt;
&lt;BR /&gt;
thanks.&lt;BR /&gt;
333  proc sql;&lt;BR /&gt;
334  reset;&lt;BR /&gt;
335  connect to db2(database=%sysget(DB2DBDFT));&lt;BR /&gt;
336  create table RM_na as&lt;BR /&gt;
337  select *&lt;BR /&gt;
338  from connection to db2(&lt;BR /&gt;
339  SELECT&lt;BR /&gt;
340       cu.cust_id&lt;BR /&gt;
341    ,  cu.cust_type_mn&lt;BR /&gt;
342    ,  cu.cust_name_tx&lt;BR /&gt;
343    ,  cu.full_busnes_na1&lt;BR /&gt;
344    ,  cuacma.acct_mgr_positn_id&lt;BR /&gt;
345    ,  acmpo.branch.no&lt;BR /&gt;
346    ,  acmapo.team.no&lt;BR /&gt;
347    ,  acmapo.positn_efectv_dt&lt;BR /&gt;
348    ,  empo.emplye_li&lt;BR /&gt;
349    ,  empo.first_na&lt;BR /&gt;
350    ,  empo.last_na&lt;BR /&gt;
351&lt;BR /&gt;
352  FROM&lt;BR /&gt;
353         EDW.cust    cu&lt;BR /&gt;
354  JOIN&lt;BR /&gt;
355         EDW.cust_acct_mgr  cuacma&lt;BR /&gt;
356  ON&lt;BR /&gt;
357        cu.cust_id = cuacma.cust_id&lt;BR /&gt;
358  JOIN&lt;BR /&gt;
359        EDW.acct_mgr_positn  acmapo&lt;BR /&gt;
360  ON&lt;BR /&gt;
361       cuacma.acct_mgr_positn_id = acmapo.acct_mgr_positn_id&lt;BR /&gt;
362  JOIN&lt;BR /&gt;
363       EDW.emplye_positn   empo&lt;BR /&gt;
364  ON&lt;BR /&gt;
365       acmapo.EMPLYE_PROFIL_ID = empo.emplye_profil_id&lt;BR /&gt;
366&lt;BR /&gt;
367  WHERE&lt;BR /&gt;
368      cu.last_change_dt &amp;lt;='2011-05-31' AND (cu.to_dt is null or cu.to_dt &amp;gt; '2011-05-31' AND&lt;BR /&gt;
369      cuacma.last_change_dt &amp;lt;= '2011-05-31' AND (cuacma.to_dt is null or cuacma.to_dt&amp;gt;&lt;BR /&gt;
369! '2011-05-31' AND&lt;BR /&gt;
370      acmapo.last_change_dt &amp;lt;= '2011-05-31' AND (acmapo.to_dt is null or acmapo.to_dt &amp;gt;&lt;BR /&gt;
370! '2011-05-31' AND&lt;BR /&gt;
371      empo.last_change_dt &amp;lt;= '2011-05-31' AND (empo.to_dt is null or empo.to_dt &amp;gt; '2011-05-31')&lt;BR /&gt;
371!  AND&lt;BR /&gt;
372      cuacma.mgr_relatn_type_cd = 1474 AND  /* Branch Account Manager AKA PRIMARY */&lt;BR /&gt;
373      acmapo.positn_type_cd = 134 AND /* MPVB */&lt;BR /&gt;
374      acmapo.branch_no = 4626  /*NMA */&lt;BR /&gt;
375          );&lt;BR /&gt;
376  disconnect from db2;&lt;BR /&gt;
377  quit;&lt;BR /&gt;
378      RUN;&lt;BR /&gt;
NOTE: Remote submit to TD complete.</description>
      <pubDate>Sun, 19 Jun 2011 18:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-won-t-this-PROC-SQL-work/m-p/16948#M3167</guid>
      <dc:creator>yaswoman</dc:creator>
      <dc:date>2011-06-19T18:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why won't this PROC SQL work</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-won-t-this-PROC-SQL-work/m-p/16949#M3168</link>
      <description>You probably need to work with your db2 folk, as this is a pass-thru query.  I see some problems in the line 369-371 area in the log.  There are no operators relating to the dates.  You also have unbalanced parentheses.&lt;BR /&gt;
&lt;BR /&gt;
Doc Muhlbaier&lt;BR /&gt;
Duke</description>
      <pubDate>Sun, 19 Jun 2011 20:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-won-t-this-PROC-SQL-work/m-p/16949#M3168</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2011-06-19T20:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: Why won't this PROC SQL work</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-won-t-this-PROC-SQL-work/m-p/16950#M3169</link>
      <description>I'll take a guess.  In your last 10 or so lines of code, three of the lines have statements that use the SAS commenting syntax (i.e., slash star, star slash).&lt;BR /&gt;
&lt;BR /&gt;
Does the code work if you simply delete the undesired code rather than attempting to comment it out?&lt;BR /&gt;
&lt;BR /&gt;
Also, while it shouldn't affect your run, the 'run' statement at the end isn't needed.&lt;BR /&gt;
&lt;BR /&gt;
Art&lt;BR /&gt;
----------&lt;BR /&gt;
&amp;gt; Hello, I am hoping some can answer this question for&lt;BR /&gt;
&amp;gt; me.  I have the PROC sql code and running it on&lt;BR /&gt;
&amp;gt; REMOTE sas.  I was given the code from someone who&lt;BR /&gt;
&amp;gt; uses WINSQL.  But as soon as I remote submit it, it&lt;BR /&gt;
&amp;gt; just comes back with not results and really no log.&lt;BR /&gt;
&amp;gt; Can someone please help. I am more a SAS DATA step&lt;BR /&gt;
&amp;gt; person so sql code is not my specialty.  Thanks so&lt;BR /&gt;
&amp;gt;  much in advance.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; thanks.&lt;BR /&gt;
&amp;gt; 333  proc sql;&lt;BR /&gt;
&amp;gt; 334  reset;&lt;BR /&gt;
&amp;gt; 335  connect to db2(database=%sysget(DB2DBDFT));&lt;BR /&gt;
&amp;gt; 336  create table RM_na as&lt;BR /&gt;
&amp;gt; 337  select *&lt;BR /&gt;
&amp;gt; 338  from connection to db2(&lt;BR /&gt;
&amp;gt; 339  SELECT&lt;BR /&gt;
&amp;gt; 340       cu.cust_id&lt;BR /&gt;
&amp;gt; 341    ,  cu.cust_type_mn&lt;BR /&gt;
&amp;gt; 342    ,  cu.cust_name_tx&lt;BR /&gt;
&amp;gt; 343    ,  cu.full_busnes_na1&lt;BR /&gt;
&amp;gt; 344    ,  cuacma.acct_mgr_positn_id&lt;BR /&gt;
&amp;gt; 345    ,  acmpo.branch.no&lt;BR /&gt;
&amp;gt; 346    ,  acmapo.team.no&lt;BR /&gt;
&amp;gt; 347    ,  acmapo.positn_efectv_dt&lt;BR /&gt;
&amp;gt; 348    ,  empo.emplye_li&lt;BR /&gt;
&amp;gt; 349    ,  empo.first_na&lt;BR /&gt;
&amp;gt; 350    ,  empo.last_na&lt;BR /&gt;
&amp;gt; 351&lt;BR /&gt;
&amp;gt; 352  FROM&lt;BR /&gt;
&amp;gt; 353         EDW.cust    cu&lt;BR /&gt;
&amp;gt; 354  JOIN&lt;BR /&gt;
&amp;gt; 355         EDW.cust_acct_mgr  cuacma&lt;BR /&gt;
&amp;gt; 356  ON&lt;BR /&gt;
&amp;gt; 357        cu.cust_id = cuacma.cust_id&lt;BR /&gt;
&amp;gt; 358  JOIN&lt;BR /&gt;
&amp;gt; 359        EDW.acct_mgr_positn  acmapo&lt;BR /&gt;
&amp;gt; 360  ON&lt;BR /&gt;
&amp;gt; 361       cuacma.acct_mgr_positn_id =&lt;BR /&gt;
&amp;gt; acmapo.acct_mgr_positn_id&lt;BR /&gt;
&amp;gt; 362  JOIN&lt;BR /&gt;
&amp;gt; 363       EDW.emplye_positn   empo&lt;BR /&gt;
&amp;gt; 364  ON&lt;BR /&gt;
&amp;gt; 365       acmapo.EMPLYE_PROFIL_ID =&lt;BR /&gt;
&amp;gt; empo.emplye_profil_id&lt;BR /&gt;
&amp;gt; 366&lt;BR /&gt;
&amp;gt; 367  WHERE&lt;BR /&gt;
&amp;gt; 368      cu.last_change_dt &amp;lt;='2011-05-31' AND&lt;BR /&gt;
&amp;gt; (cu.to_dt is null or cu.to_dt &amp;gt; '2011-05-31' AND&lt;BR /&gt;
&amp;gt; 369      cuacma.last_change_dt &amp;lt;= '2011-05-31' AND&lt;BR /&gt;
&amp;gt; (cuacma.to_dt is null or cuacma.to_dt&amp;gt;&lt;BR /&gt;
&amp;gt; 369! '2011-05-31' AND&lt;BR /&gt;
&amp;gt; 370      acmapo.last_change_dt &amp;lt;= '2011-05-31' AND&lt;BR /&gt;
&amp;gt; (acmapo.to_dt is null or acmapo.to_dt &amp;gt;&lt;BR /&gt;
&amp;gt; 370! '2011-05-31' AND&lt;BR /&gt;
&amp;gt; 371      empo.last_change_dt &amp;lt;= '2011-05-31' AND&lt;BR /&gt;
&amp;gt; (empo.to_dt is null or empo.to_dt &amp;gt; '2011-05-31')&lt;BR /&gt;
&amp;gt; 371!  AND&lt;BR /&gt;
&amp;gt; 372      cuacma.mgr_relatn_type_cd = 1474 AND  /*&lt;BR /&gt;
&amp;gt; Branch Account Manager AKA PRIMARY */&lt;BR /&gt;
&amp;gt; 373      acmapo.positn_type_cd = 134 AND /* MPVB */&lt;BR /&gt;
&amp;gt; 374      acmapo.branch_no = 4626  /*NMA */&lt;BR /&gt;
&amp;gt; 375          );&lt;BR /&gt;
&amp;gt; 376  disconnect from db2;&lt;BR /&gt;
&amp;gt; 377  quit;&lt;BR /&gt;
&amp;gt; 378      RUN;&lt;BR /&gt;
&amp;gt; NOTE: Remote submit to TD complete.</description>
      <pubDate>Sun, 19 Jun 2011 20:41:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-won-t-this-PROC-SQL-work/m-p/16950#M3169</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-06-19T20:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why won't this PROC SQL work</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-won-t-this-PROC-SQL-work/m-p/16951#M3170</link>
      <description>Hi &lt;BR /&gt;
&lt;BR /&gt;
You're using pass-through SQL so the SQL syntax must be in the DB2 flavor.&lt;BR /&gt;
&lt;BR /&gt;
I believe your where clause is not valid DB2 SQL syntax. I would expect it to look something like:&lt;BR /&gt;
&lt;BR /&gt;
WHERE&lt;BR /&gt;
cu.last_change_dt = date('2011-05-31') AND&lt;BR /&gt;
cuacma.last_change_dt = date('2011-05-31') AND&lt;BR /&gt;
acmapo.last_change_dt = date('2011-05-31') AND&lt;BR /&gt;
empo.last_change_dt = date('2011-05-31') AND&lt;BR /&gt;
....&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Mon, 20 Jun 2011 04:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-won-t-this-PROC-SQL-work/m-p/16951#M3170</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-06-20T04:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Why won't this PROC SQL work</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-won-t-this-PROC-SQL-work/m-p/16952#M3171</link>
      <description>Thank you so much for all the quick responses. Will make changes and let you know.  &lt;BR /&gt;
thanks</description>
      <pubDate>Mon, 20 Jun 2011 13:07:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-won-t-this-PROC-SQL-work/m-p/16952#M3171</guid>
      <dc:creator>yaswoman</dc:creator>
      <dc:date>2011-06-20T13:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why won't this PROC SQL work</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-won-t-this-PROC-SQL-work/m-p/16953#M3172</link>
      <description>made all the changes, and works like a charm.  thanks guys.</description>
      <pubDate>Mon, 20 Jun 2011 13:36:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-won-t-this-PROC-SQL-work/m-p/16953#M3172</guid>
      <dc:creator>yaswoman</dc:creator>
      <dc:date>2011-06-20T13:36:19Z</dc:date>
    </item>
  </channel>
</rss>

