<?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: Find the no. of ampersands in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Find-the-no-of-ampersands/m-p/518709#M140416</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you need that for ?&lt;/P&gt;
&lt;P&gt;If you need more that three ampersands to resolve a macrovariable there&lt;/P&gt;
&lt;P&gt;is probably a design problem in your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let TRUE=GE;
%let GE=AND;
%let AND=LE;
%let LE=TRUE;

%macro MinAmpersand(var);

    data _NULL_;
	    length value $4. amps $20.;
	    var="&amp;amp;var.";

		amps="&amp;amp;";

		do while (var ne value and MAX_LOOP&amp;lt;20);
		    MAX_LOOP+1;
		    value=resolve(cats(amps,"TRUE"));
			amps=cats(amps,"&amp;amp;");
		end;

		nbamps=length(amps)-1;

		put nbamps " ampersands necessary for macrovariable &amp;amp;var.";
	run;

%mend;

%MinAmpersand(TRUE);
%MinAmpersand(GE);
%MinAmpersand(AND);
%MinAmpersand(LE);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 05 Dec 2018 09:12:22 GMT</pubDate>
    <dc:creator>gamotte</dc:creator>
    <dc:date>2018-12-05T09:12:22Z</dc:date>
    <item>
      <title>Find the no. of ampersands</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-no-of-ampersands/m-p/518643#M140388</link>
      <description>&lt;P&gt;Write a macro program to find out &lt;STRONG&gt;how many&lt;/STRONG&gt; ampersands is needed for generating the specified result.&lt;/P&gt;&lt;P&gt;Given a series of macro variables:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let a=b;&lt;/P&gt;&lt;P&gt;%let b=c;&lt;/P&gt;&lt;P&gt;%let c=d;&lt;/P&gt;&lt;P&gt;%let d=e;&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;&lt;P&gt;Pls help. Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 03:13:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-no-of-ampersands/m-p/518643#M140388</guid>
      <dc:creator>KeinYung</dc:creator>
      <dc:date>2018-12-19T03:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: Find the no. of ampersands</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-no-of-ampersands/m-p/518678#M140392</link>
      <description>&lt;P&gt;What have you tried so far?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 06:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-no-of-ampersands/m-p/518678#M140392</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-12-05T06:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Find the no. of ampersands</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-no-of-ampersands/m-p/518709#M140416</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you need that for ?&lt;/P&gt;
&lt;P&gt;If you need more that three ampersands to resolve a macrovariable there&lt;/P&gt;
&lt;P&gt;is probably a design problem in your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let TRUE=GE;
%let GE=AND;
%let AND=LE;
%let LE=TRUE;

%macro MinAmpersand(var);

    data _NULL_;
	    length value $4. amps $20.;
	    var="&amp;amp;var.";

		amps="&amp;amp;";

		do while (var ne value and MAX_LOOP&amp;lt;20);
		    MAX_LOOP+1;
		    value=resolve(cats(amps,"TRUE"));
			amps=cats(amps,"&amp;amp;");
		end;

		nbamps=length(amps)-1;

		put nbamps " ampersands necessary for macrovariable &amp;amp;var.";
	run;

%mend;

%MinAmpersand(TRUE);
%MinAmpersand(GE);
%MinAmpersand(AND);
%MinAmpersand(LE);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Dec 2018 09:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-no-of-ampersands/m-p/518709#M140416</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-12-05T09:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Find the no. of ampersands</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-no-of-ampersands/m-p/518912#M140469</link>
      <description>&lt;P&gt;I see a similar question has been asked here:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Count-the-number-of-ampersands/m-p/518736#M73337" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/Count-the-number-of-ampersands/m-p/518736#M73337&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can only assume it is some sort of homework assignment. Personally I don't see the value in these types of intellectual challenges.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 19:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-no-of-ampersands/m-p/518912#M140469</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-12-05T19:32:26Z</dc:date>
    </item>
  </channel>
</rss>

