<?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 Macro variables are resolving but not able to get the corresponding data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-variables-are-resolving-but-not-able-to-get-the/m-p/294840#M270221</link>
    <description>&lt;P&gt;Hi SAS Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am trying to create two macro variables one for Year &amp;nbsp;one for Product in sashelp.prdsal2 dataset.&lt;/P&gt;&lt;P&gt;When am substituting both the macro variable, the variables are resolving but the am unable to get the corresponding data.&lt;/P&gt;&lt;P&gt;Below is my code... Please guide me about my mistake&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%LET YR=1995;&lt;BR /&gt;%LET PD='SOFA';&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE NEW AS&lt;BR /&gt;SELECT DISTINCT PRODUCT,SUM(ACTUAL) AS TOTAL,STATE FROM SASHELP.PRDSAL2&lt;BR /&gt;WHERE YEAR=&amp;amp;YR. AND PRODUCT="&amp;amp;PD"&lt;BR /&gt;GROUP BY STATE;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;/*By using the above code am not getting any data and there is no error*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE NEW1 AS&lt;BR /&gt;SELECT DISTINCT PRODUCT,SUM(ACTUAL) AS TOTAL,STATE FROM SASHELP.PRDSAL2&lt;BR /&gt;WHERE YEAR=1995. AND PRODUCT="SOFA"&lt;BR /&gt;GROUP BY STATE;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;/*without using the macro variable am getting the information*/&lt;/P&gt;</description>
    <pubDate>Mon, 29 Aug 2016 14:17:43 GMT</pubDate>
    <dc:creator>sanjay1</dc:creator>
    <dc:date>2016-08-29T14:17:43Z</dc:date>
    <item>
      <title>Macro variables are resolving but not able to get the corresponding data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variables-are-resolving-but-not-able-to-get-the/m-p/294840#M270221</link>
      <description>&lt;P&gt;Hi SAS Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am trying to create two macro variables one for Year &amp;nbsp;one for Product in sashelp.prdsal2 dataset.&lt;/P&gt;&lt;P&gt;When am substituting both the macro variable, the variables are resolving but the am unable to get the corresponding data.&lt;/P&gt;&lt;P&gt;Below is my code... Please guide me about my mistake&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%LET YR=1995;&lt;BR /&gt;%LET PD='SOFA';&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE NEW AS&lt;BR /&gt;SELECT DISTINCT PRODUCT,SUM(ACTUAL) AS TOTAL,STATE FROM SASHELP.PRDSAL2&lt;BR /&gt;WHERE YEAR=&amp;amp;YR. AND PRODUCT="&amp;amp;PD"&lt;BR /&gt;GROUP BY STATE;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;/*By using the above code am not getting any data and there is no error*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE NEW1 AS&lt;BR /&gt;SELECT DISTINCT PRODUCT,SUM(ACTUAL) AS TOTAL,STATE FROM SASHELP.PRDSAL2&lt;BR /&gt;WHERE YEAR=1995. AND PRODUCT="SOFA"&lt;BR /&gt;GROUP BY STATE;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;/*without using the macro variable am getting the information*/&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 14:17:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variables-are-resolving-but-not-able-to-get-the/m-p/294840#M270221</guid>
      <dc:creator>sanjay1</dc:creator>
      <dc:date>2016-08-29T14:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variables are resolving but not able to get the corresponding data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variables-are-resolving-but-not-able-to-get-the/m-p/294845#M270222</link>
      <description>&lt;P&gt;Too many quotation marks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it will resolve to, extra spaces added for illustration.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;product = " ' Sofa ' " ;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remove the single quotes from your macro variable declaration.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 14:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variables-are-resolving-but-not-able-to-get-the/m-p/294845#M270222</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-29T14:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variables are resolving but not able to get the corresponding data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variables-are-resolving-but-not-able-to-get-the/m-p/294847#M270223</link>
      <description>&lt;P&gt;You have single quotes around SOFA in the macro variable. Since&amp;nbsp;you are using double&amp;nbsp;quotes&amp;nbsp;in the SQL, the single quotes will&amp;nbsp;be a part of the string matching criteria.&lt;/P&gt;
&lt;P&gt;Either omit&amp;nbsp;the single or the double&amp;nbsp;quotes.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options symbolgen;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;can help you notice such mistakes.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 14:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variables-are-resolving-but-not-able-to-get-the/m-p/294847#M270223</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-08-29T14:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variables are resolving but not able to get the corresponding data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variables-are-resolving-but-not-able-to-get-the/m-p/294858#M270224</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;As you suggested I have removed the qoutes but still it is not working..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it is possible could you please right the code with change. please guide&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 15:04:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variables-are-resolving-but-not-able-to-get-the/m-p/294858#M270224</guid>
      <dc:creator>sanjay1</dc:creator>
      <dc:date>2016-08-29T15:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variables are resolving but not able to get the corresponding data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variables-are-resolving-but-not-able-to-get-the/m-p/294885#M270225</link>
      <description>&lt;P&gt;Post your new code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should only have removed the quotes from the LET statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically you need to make the macro code generate text that's valid SAS syntax.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 16:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variables-are-resolving-but-not-able-to-get-the/m-p/294885#M270225</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-29T16:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variables are resolving but not able to get the corresponding data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variables-are-resolving-but-not-able-to-get-the/m-p/294933#M270226</link>
      <description>&lt;P&gt;remove the dot&amp;nbsp;after the year 1995 (you wrote: 1995.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the dot after a macro varible assigns its end&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 20:17:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variables-are-resolving-but-not-able-to-get-the/m-p/294933#M270226</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-08-29T20:17:40Z</dc:date>
    </item>
  </channel>
</rss>

