<?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 code help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-code-help/m-p/468979#M119863</link>
    <description>&lt;P&gt;Or perhaps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let flag= &amp;amp; flag='Y';
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which would only add to the confusion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 10 Jun 2018 05:25:27 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2018-06-10T05:25:27Z</dc:date>
    <item>
      <title>proc sql code help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-code-help/m-p/468976#M119860</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The sql code appeared in a macro. I want to know why '&lt;FONT color="#993300"&gt;1' is&amp;nbsp;&lt;/FONT&gt; in where statement. Please help. Thank you&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let flag=flag='Y'&lt;BR /&gt;proc sql;
   create table population_extract  as
      select distinct
             adsl.studyid
            ,adsl.sitenum
                
      from adsl as a left join adex as b
      where	&lt;FONT color="#0000FF"&gt;1&lt;/FONT&gt;
         	&amp;amp;flag
       ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Jun 2018 04:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-code-help/m-p/468976#M119860</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2018-06-10T04:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql code help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-code-help/m-p/468977#M119861</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/68272"&gt;@knveraraju91&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I can only guess but I assume this allows for the &amp;amp;FLAG macro variable to be empty.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the &amp;amp;flag variable is empty then the where clause will resolve to &lt;EM&gt;WHERE 1&lt;/EM&gt; which is always TRUE - the condition could also be &lt;EM&gt;WHERE 1=1&amp;nbsp;&lt;/EM&gt;which maybe would be easier to understand.&lt;/P&gt;
&lt;P&gt;You need some hard coded condition as a WHERE clause without anything would lead to a syntax error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF you populated the &amp;amp;FLAG macro variable then you need to use a string with results n a valid WHERE clause so something like below which then resolves to &lt;EM&gt;WHERE 1 AND flag='Y'&lt;/EM&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let flag= AND flag='Y';
proc sql;
   create table population_extract  as
      select distinct
             adsl.studyid
            ,adsl.sitenum
                
      from adsl as a left join adex as b
      where	1
         	&amp;amp;flag
       ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Jun 2018 05:03:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-code-help/m-p/468977#M119861</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-06-10T05:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql code help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-code-help/m-p/468979#M119863</link>
      <description>&lt;P&gt;Or perhaps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let flag= &amp;amp; flag='Y';
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which would only add to the confusion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jun 2018 05:25:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-code-help/m-p/468979#M119863</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-06-10T05:25:27Z</dc:date>
    </item>
  </channel>
</rss>

