<?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 where based on external declared variable in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-where-based-on-external-declared-variable/m-p/306262#M60982</link>
    <description>&lt;P&gt;Dear RW9,&lt;/P&gt;&lt;P&gt;thanks for your support, the data is specified as it follows:&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;%let date=201609&lt;/STRONG&gt; and I cannot change it (e.g. '201609').&amp;nbsp;I cannot share the data set I am working on. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Oct 2016 12:29:02 GMT</pubDate>
    <dc:creator>Sir_Highbury</dc:creator>
    <dc:date>2016-10-21T12:29:02Z</dc:date>
    <item>
      <title>proc sql where based on external declared variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-where-based-on-external-declared-variable/m-p/306231#M60976</link>
      <description>&lt;P&gt;Dear experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following variable:&amp;nbsp;PAID_YYYYMM (length 25,&amp;nbsp;format $25.,&amp;nbsp;informat $25.)&lt;/P&gt;&lt;P&gt;I would like to filter the table using the following variable:&amp;nbsp;%let date=201609;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do it I am using the proc sql, stating the where as:&amp;nbsp;&lt;SPAN&gt;PAID_YYYYMM='201609' but replacing the number with the variable date.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried the following matching but I get always an empty data set:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;where PAID_YYYYMM='&amp;amp;date.' ;quit;&lt;BR /&gt;/* where PUT(PAID_YYYYMM, $10.)="'&amp;amp;date.'" ;quit; */&lt;BR /&gt;/* where PUT(PAID_YYYYMM, $10.)='&amp;amp;date.' ;quit; */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is wrong in the logic used?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance for the support.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SH&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 10:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-where-based-on-external-declared-variable/m-p/306231#M60976</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-10-21T10:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql where based on external declared variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-where-based-on-external-declared-variable/m-p/306253#M60979</link>
      <description>&lt;P&gt;Well, take a look at what is generated from the macro:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;where PAID_YYYYMM='&amp;amp;date.' ;quit;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%let date='201609';&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Then:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;where PAID_YYYYMM='201609';&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Are there recrod in your read in dataset where paid_yyyymm='201609'?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Its very hard to tell you what is wrong with the logic without seeing the data it is operating on - post some test data (in the form of a datastep) will make it easier to debug.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 11:26:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-where-based-on-external-declared-variable/m-p/306253#M60979</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-21T11:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql where based on external declared variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-where-based-on-external-declared-variable/m-p/306260#M60981</link>
      <description>&lt;P&gt;If you really used single quotes around the macro variable, why are you surprised?&lt;/P&gt;
&lt;P&gt;Single quotes prevent the resolution of macro triggers. Use double quotes.&amp;nbsp;&lt;U&gt;Only&lt;/U&gt; double quotes.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 12:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-where-based-on-external-declared-variable/m-p/306260#M60981</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-21T12:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql where based on external declared variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-where-based-on-external-declared-variable/m-p/306262#M60982</link>
      <description>&lt;P&gt;Dear RW9,&lt;/P&gt;&lt;P&gt;thanks for your support, the data is specified as it follows:&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;%let date=201609&lt;/STRONG&gt; and I cannot change it (e.g. '201609').&amp;nbsp;I cannot share the data set I am working on. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 12:29:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-where-based-on-external-declared-variable/m-p/306262#M60982</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-10-21T12:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql where based on external declared variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-where-based-on-external-declared-variable/m-p/306440#M61016</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/78691"&gt;@Sir_Highbury&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I cannot share the data set I am working on. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;You don't need to share the data set you're working on. &lt;U&gt;&lt;STRONG&gt;You need to provide sample data, which can be fake, that is enough to replicate your problem.&lt;/STRONG&gt;&lt;/U&gt; It just needs to be similar enough so we can understand your issue. You'll get better and faster answers. if you do this.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 20:34:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-where-based-on-external-declared-variable/m-p/306440#M61016</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-21T20:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql where based on external declared variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-where-based-on-external-declared-variable/m-p/306737#M61052</link>
      <description>&lt;P&gt;It was a clear question and I got the issue solved without losing time to create the fake error. Thanks for your effort but please&amp;nbsp;try to answer if you can. The decision about the question and if and how attach data is mine, if you disagree feel free to ignore the topic. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Have a nice day, SH&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2016 09:26:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-where-based-on-external-declared-variable/m-p/306737#M61052</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-10-24T09:26:23Z</dc:date>
    </item>
  </channel>
</rss>

