<?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: macro variable value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77777#M16871</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;I really like your nutshell style of explantation. Those macro quote facilities are just as annoying to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Sep 2012 13:31:04 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2012-09-28T13:31:04Z</dc:date>
    <item>
      <title>macro variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77770#M16864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to allocate this value to a macro variable but am getting an error message (using SAS EG 4.1):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let WarnTxt1= Warning - This component has a low value of Cronbach's Alpha (less than 0.7);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I imagine this could be due to the length of the string and/or certain characters. Is there a way to make SAS accept this string?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The warning I am getting is " The quoted string currently being processed has become more than 262 characters long.&amp;nbsp; You may have unbalanced quotation marks."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;VD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Vikas Dhawan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2012 13:33:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77770#M16864</guid>
      <dc:creator>VD</dc:creator>
      <dc:date>2012-09-26T13:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77771#M16865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to mask the quote.&amp;nbsp; e.g.:&lt;/P&gt;&lt;P&gt;%let WarnTxt1= Warning - This component has a low value of %nrbquote(Cronbach's) Alpha (less than 0.7);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Note: I originally had included the following comment: "That works on 9.3, but I seem to recall that macro variable names couldn't end with a number in older versions of SAS.".&amp;nbsp; Too early in the morning!&amp;nbsp; Character formats can't end in a number .. macro variables can).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2012 13:50:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77771#M16865</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-09-26T13:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77772#M16866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try adding double quotes around the verbage...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let WarnTxt1= "Warning - This component has a low value of Cronbach's Alpha (less than 0.7)";&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2012 14:02:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77772#M16866</guid>
      <dc:creator>robby_beum</dc:creator>
      <dc:date>2012-09-26T14:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77773#M16867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Arthur ,&lt;/P&gt;&lt;P&gt;I would like to use %str() which is designed for it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let WarnTxt1=%str(Warning - This component has a low value of Cronbach%'s Alpha %(less than 0.7%) );&lt;/P&gt;&lt;P&gt;%put WARNING: &amp;amp;warntxt1 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2012 02:30:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77773#M16867</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-09-27T02:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77774#M16868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, the "mess" that is SAS macro quoting and the lack of obviousness that is choosing the right masking macro function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First there was %NR/STR, than %NR/QUOTE, after that %NR/BQUOTE was introduced, and at last %SUPER...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And each one has one or more particular set of features, being:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Compile time, and runtime execution:&lt;/P&gt;&lt;P&gt;Some operate at compile time, while the others only evaluate at runtime (nothing happens at compile time their treated as text).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- percent and ampersand masking:&lt;/P&gt;&lt;P&gt;Easy to identify, every* macro function starting with %NR will mask the % and &amp;amp; preventing the resolve of macro variables/functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- unmatched single quotes, double quotes and parentheses masking:&lt;/P&gt;&lt;P&gt;Actually all quoting functions are capable of masking unmatched single/double quotes and parentheses, but some mask them char by char while other do this by pair unless you explicitly identify the unmatched pairs prefixing the char with a percent sign (%).&lt;/P&gt;&lt;P&gt;Every* functions starting with the form %NRB* or %B* do not need to identify unmatched pairs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* there's actually a macro quoting function that doesn't follow the rule, %SUPER, which (as the name says) is the super-mega-power-thing on macro quoting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So with that, and knowing that %STR is a compile time function and %NRBQUOTE is a runtime one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%STR will not mask percent and ampersand (no %NR prefix) and will require to identify unmatched pairs (no %B* prefix).&lt;/P&gt;&lt;P&gt;%NRBQUOTE will mask percent and ampersand (%NR prefix) and will not require to identify unmatched pairs (%NRB* prefix).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your particular case, % and &amp;amp; masking is not need, and the moment of function evaluation is pretty much irrelevant (compile/runtime).&lt;/P&gt;&lt;P&gt;So, since you have a single unmatched quote, it's pretty much a matter of choosing If you want to identify it or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From there, you may choose one of three functions. %STR or %QUOTE, which both require the % before the single quote and differ only on execution time (compile/runtime). Or %BQUOTE, which will not require to identify the unmatched quote, and is evaluated at runtime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All suggestions above are correct, as they will solve VD's single quote problem. That being said...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Artur, %NRBQUOTE is actually more than it's needed as there is no &amp;amp; or % to mask, %BQUOTE is just enough.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;@Ksharp, f&lt;/SPAN&gt;or %STR there is no need to mask matched pairs(), just the unmatched single quote.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers from Portugal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2012 08:43:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77774#M16868</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2012-09-27T08:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77775#M16869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your replies, much appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%NRBQUOTE and %BQUOTE seem to work fine. But only in Base SAS (9.1). Somehow they are not working in EG(4.1) for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I managed to make it work using use call symputx - perhaps not the most neat solution!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_; set in1;&lt;/P&gt;&lt;P&gt;format Txt1 $76. ;&lt;/P&gt;&lt;P&gt;Txt1="Warning - This component has a low value of Cronbach's Alpha (less than 0.7)";&lt;/P&gt;&lt;P&gt;call symputx("WarnTxt1",Txt1);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;P&gt;VD&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2012 08:59:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77775#M16869</guid>
      <dc:creator>VD</dc:creator>
      <dc:date>2012-09-27T08:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77776#M16870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Daniel Santos&lt;/P&gt;&lt;P&gt;Yes. I know it too. just for the safe . &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2012 02:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77776#M16870</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-09-28T02:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77777#M16871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;I really like your nutshell style of explantation. Those macro quote facilities are just as annoying to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2012 13:31:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-value/m-p/77777#M16871</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-09-28T13:31:04Z</dc:date>
    </item>
  </channel>
</rss>

