<?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: Comaparing Macro variables characters with spaces in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/464072#M5691</link>
    <description>&lt;P&gt;That was it... Was calling the %superq variable incorrectly (using &amp;amp;&amp;amp; before first partial variable name).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and %bquote allows for the comparison.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Tue, 22 May 2018 14:45:41 GMT</pubDate>
    <dc:creator>TimMandell</dc:creator>
    <dc:date>2018-05-22T14:45:41Z</dc:date>
    <item>
      <title>Comaparing Macro variables characters with spaces</title>
      <link>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/463880#M5685</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have two Macro variables&amp;nbsp;that resolve to sentences when I attempt to compare them the evaluation method sees the first word in the resolved variable as another variable and provides and error as shown below.&amp;nbsp; Thank you in advance for your response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do chg = 1 %to &amp;amp;m_ln;

	/*response */
	%if %sysevalf(%superq( &amp;amp;&amp;amp;asp&amp;amp;chg ) ne , boolean)  %then %do;
		%if "%NRBQUOTE(&amp;amp;&amp;amp;asp&amp;amp;chg)" ne "%NRBQUOTE(&amp;amp;&amp;amp;bsp&amp;amp;chg)" %then %do;
		proc sql;
   		update dat.rvw_data 	set auditor = "&amp;amp;usr", Response="%NRBQUOTE(&amp;amp;&amp;amp;asp&amp;amp;chg)", audit_date="&amp;amp;srttm" where id= &amp;amp;&amp;amp;id&amp;amp;chg;
 		quit;
		%end;
	%end;
%end;

/*
where asp&amp;amp;chg  and bsp&amp;amp;chg can resolve to values like

Clean Up your room

The room is clean

New Chore

Old Chore


example error
SYMBOLGEN:  Macro variable ASP1 resolves to Clean Up your room
ERROR: Invalid symbolic variable name CLEAN.
*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 May 2018 20:50:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/463880#M5685</guid>
      <dc:creator>TimMandell</dc:creator>
      <dc:date>2018-05-21T20:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: Comaparing Macro variables characters with spaces</title>
      <link>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/463884#M5686</link>
      <description>&lt;P&gt;If these values are truly representative of your data, it is overkill to use double-quotes around %NRBQUOTE.&amp;nbsp; Most likely the problem is stemming from the SQL code (not the %IF %THEN statement), since SQL is notoriously poor at parsing macro-quoted strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can test the theory seeing if this change runs without error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Response = "&amp;amp;&amp;amp;asp&amp;amp;chg"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other %NRBQUOTEs are probably overkill but don't hurt anything.&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 20:59:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/463884#M5686</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-21T20:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Comaparing Macro variables characters with spaces</title>
      <link>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/463961#M5687</link>
      <description>&lt;P&gt;And why are you doing this with a list of macro variables instead of a dataset?&lt;/P&gt;
&lt;P&gt;Keep in mind that the macro processor is a&amp;nbsp;&lt;EM&gt;code generator&lt;/EM&gt;, not a&amp;nbsp;&lt;EM&gt;data handler&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 06:01:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/463961#M5687</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-22T06:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: Comaparing Macro variables characters with spaces</title>
      <link>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/464031#M5688</link>
      <description>&lt;P&gt;I have an input form&amp;nbsp;using HTML/Javascript and&amp;nbsp;initiated by stored process.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The variables contents&amp;nbsp;to compare&amp;nbsp;are the values obtained from the input form.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems very straight forward to compare the variables directly rather then moving the values into a dataset and making comparisons in that manner.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The next step after comparison is for inequalities&amp;nbsp;replace the current value to the new value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 13:22:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/464031#M5688</guid>
      <dc:creator>TimMandell</dc:creator>
      <dc:date>2018-05-22T13:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: Comaparing Macro variables characters with spaces</title>
      <link>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/464046#M5689</link>
      <description>&lt;P&gt;The fact that you had to come here seeking help should tell you that it is not straight forward at all.&lt;/P&gt;
&lt;P&gt;That's because the macro processor is not the right engine for this at all. Once, again, it's a code generator, not meant to deal with data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Both the data step and proc sql provide simple means for updating one dataset from the other. A check for inequality is not needed, as the update would replace a value with the same value anyway (in case of them being equal), causing no harm.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Getting a list of macro variables into a dataset OTOH IS straight forward:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let asp1=The room is clean;
%let asp2=The room needs to be cleaned;
%let m_ln=2;

data data_upd;
length response $50;
do chg = 1 to &amp;amp;m_ln;
  response = symget(cats('asp',chg));
  output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 May 2018 13:41:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/464046#M5689</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-22T13:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Comaparing Macro variables characters with spaces</title>
      <link>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/464052#M5690</link>
      <description>&lt;P&gt;Looks to me like the problem is with %SUPERQ.&amp;nbsp; You pass it the name of a macro variable without an &amp;amp; in front, unlike the other quoting functions which get passed a reference to a macro variable with the &amp;amp;.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I don't think %NRBQUOTE is good for anything.&amp;nbsp; I would suggest (untested):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	%if %sysevalf(%superq(asp&amp;amp;chg) ne , boolean)  %then %do;
		%if %BQUOTE(&amp;amp;&amp;amp;asp&amp;amp;chg) ne %BQUOTE(&amp;amp;&amp;amp;bsp&amp;amp;chg) %then %do;
		proc sql;
   		update dat.rvw_data 	set auditor = "&amp;amp;usr", Response="%BQUOTE(&amp;amp;&amp;amp;asp&amp;amp;chg)", audit_date="&amp;amp;srttm" where id= &amp;amp;&amp;amp;id&amp;amp;chg;
 		quit;
		%end;
	%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 14:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/464052#M5690</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2018-05-22T14:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Comaparing Macro variables characters with spaces</title>
      <link>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/464072#M5691</link>
      <description>&lt;P&gt;That was it... Was calling the %superq variable incorrectly (using &amp;amp;&amp;amp; before first partial variable name).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and %bquote allows for the comparison.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 14:45:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Comaparing-Macro-variables-characters-with-spaces/m-p/464072#M5691</guid>
      <dc:creator>TimMandell</dc:creator>
      <dc:date>2018-05-22T14:45:41Z</dc:date>
    </item>
  </channel>
</rss>

