<?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: obtain required Id using defined macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/obtain-required-Id-using-defined-macro/m-p/704151#M215839</link>
    <description>&lt;P&gt;The macro processor ignores &amp;amp; and % inside of single quotes. So the macro processor ignored this line.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where id='&amp;amp;Req_id';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;so you tried to compare the value if ID to ampersand followed by letters Req_id.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you defined ID as numeric you want to write a line like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where id=4;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So how should you change the line of code to have that text generated by the macro processor?&lt;/P&gt;</description>
    <pubDate>Mon, 07 Dec 2020 14:53:01 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-12-07T14:53:01Z</dc:date>
    <item>
      <title>obtain required Id using defined macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/obtain-required-Id-using-defined-macro/m-p/704029#M215781</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dup;
input id city$;
cards;
1 hyd
2 blg
2 chn
3 hyd
3 gurg
4 mumb
;
run;




%let Req_id=4;
proc print data=dup noobs;
where id='&amp;amp;Req_id';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here I have sample table then i defined macro variable Req_id; to get required id&amp;nbsp;&lt;/P&gt;&lt;P&gt;but above code shows error&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anandkvn_0-1607312306633.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/52380i52EEB077B791EA11/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anandkvn_0-1607312306633.png" alt="Anandkvn_0-1607312306633.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 03:38:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/obtain-required-Id-using-defined-macro/m-p/704029#M215781</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2020-12-07T03:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: obtain required Id using defined macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/obtain-required-Id-using-defined-macro/m-p/704053#M215793</link>
      <description>&lt;P&gt;Two issues:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The macro process will pass on the quotes, so the regular sas language compiler will see those quotes and presume you expect ID to be a character variable.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;But even if ID were a character variable here, your program would fail to find an observation.&amp;nbsp; This is because there is an important relationship between the macro interpreter and single quotes vs double quotes.&amp;nbsp; Namely, the macro interpreter will not attempt to resolve the macrovar value inside single quotes, but will resolve text inside double quotes.&amp;nbsp; &amp;nbsp;If ID were a character variable, you would need to use double quotes.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 07 Dec 2020 06:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/obtain-required-Id-using-defined-macro/m-p/704053#M215793</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-12-07T06:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: obtain required Id using defined macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/obtain-required-Id-using-defined-macro/m-p/704060#M215799</link>
      <description>solution please</description>
      <pubDate>Mon, 07 Dec 2020 06:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/obtain-required-Id-using-defined-macro/m-p/704060#M215799</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2020-12-07T06:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: obtain required Id using defined macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/obtain-required-Id-using-defined-macro/m-p/704071#M215809</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;solution please&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have already got it, with a nice explanation. Don't be rude to people trying to help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 07:28:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/obtain-required-Id-using-defined-macro/m-p/704071#M215809</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-07T07:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: obtain required Id using defined macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/obtain-required-Id-using-defined-macro/m-p/704128#M215835</link>
      <description>&lt;P&gt;First, get this code to work WITHOUT macro variables. You have not done this. Once you get it to work without macro variables, then it will be easy to get it to work WITH macro variables. If you can't get it to work WITHOUT macro variables, then it will never work WITH macro variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;The above is the process you ought to follow for any attempt to use macro variables or macros.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Show us working code WITHOUT macro variables.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 13:15:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/obtain-required-Id-using-defined-macro/m-p/704128#M215835</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-12-07T13:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: obtain required Id using defined macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/obtain-required-Id-using-defined-macro/m-p/704151#M215839</link>
      <description>&lt;P&gt;The macro processor ignores &amp;amp; and % inside of single quotes. So the macro processor ignored this line.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where id='&amp;amp;Req_id';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;so you tried to compare the value if ID to ampersand followed by letters Req_id.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you defined ID as numeric you want to write a line like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where id=4;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So how should you change the line of code to have that text generated by the macro processor?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 14:53:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/obtain-required-Id-using-defined-macro/m-p/704151#M215839</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-12-07T14:53:01Z</dc:date>
    </item>
  </channel>
</rss>

