<?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: Removing SAS warning when using the % sign in a test in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695261#M212140</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/152501"&gt;@alexgonzalez&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;In the previous code also shown below, the missing ' was accidentally deleted when I copied the code from my original code.&lt;BR /&gt;label=%upcase('%E from FS.);&lt;BR /&gt;output;&lt;BR /&gt;I removed the %UPCASE function as you suggested and still getting the warning message. &lt;BR /&gt;Additionally, let's say I also want to pass a macro variable into the label as follows:&lt;BR /&gt;label="%E FROM FS in &amp;amp;agesex";&lt;BR /&gt;Thanks a lot BallardW.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The show WHERE the macro value is created. If you don't want the warning to appear then concatenating text prior that step into a single macro variable would be the answer.&lt;/P&gt;
&lt;P&gt;This appears to do what you want without creating the warning messages.&lt;/P&gt;
&lt;PRE&gt;%let agesex = something;
%let string = %nrstr(%E FROM FS IN ) &amp;amp;agesex.;
%put &amp;amp;string;

data junk;
   x=1;
   label x ="&amp;amp;string.";
run;&lt;/PRE&gt;</description>
    <pubDate>Thu, 29 Oct 2020 16:20:37 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-10-29T16:20:37Z</dc:date>
    <item>
      <title>Removing SAS warning when using the % sign in a test</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695196#M212103</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I want to include the % sign in a text in a dataset as follows:&lt;/P&gt;
&lt;P&gt;label=%upcase('%E from FS');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I pass that text in PROC SGPLOT via SGANNO, I get the following warning message:&lt;/P&gt;
&lt;P&gt;WARNING: Apparent invocation of macro E not resolved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please advice on how to get rid of that message?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried different options, but nothing is working.&lt;/P&gt;
&lt;P&gt;Thanks a lot,&lt;/P&gt;
&lt;P&gt;A.G.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 14:12:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695196#M212103</guid>
      <dc:creator>alexgonzalez</dc:creator>
      <dc:date>2020-10-29T14:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Removing SAS warning when using the % sign in a test</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695199#M212105</link>
      <description>&lt;P&gt;Please show the entire code of the steps involved.&lt;/P&gt;
&lt;P&gt;It appears that you may be using %upcase in a data step where the function should be Upcase.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 14:17:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695199#M212105</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-10-29T14:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Removing SAS warning when using the % sign in a test</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695206#M212110</link>
      <description>Please, see the code below. Let me know if something is still not clear enough.&lt;BR /&gt; Data anno;&lt;BR /&gt;	  function="text"; &lt;BR /&gt;	  x1space= 'graphpercent';&lt;BR /&gt;	  y1space= 'graphpercent';&lt;BR /&gt;	  width=200;&lt;BR /&gt;	  textweight='bold';&lt;BR /&gt;	  textsize=10;&lt;BR /&gt;	  y1=98.5;&lt;BR /&gt;	  x1=50;&lt;BR /&gt;	label=%upcase('%E from FS.);&lt;BR /&gt;	output;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc sgplot data=stats_plot noborder sganno=anno;&lt;BR /&gt;  scatter y=variable  x=mean / xerrorlower=p25 &lt;BR /&gt;                               xerrorupper=p75 &lt;BR /&gt;                               noerrorcaps;&lt;BR /&gt;&lt;BR /&gt;  refline 0 / axis=x &lt;BR /&gt;              lineattrs=(thickness=3 &lt;BR /&gt;	          color=blb pattern=dash);&lt;BR /&gt;  yaxis label= %upcase('Distribution parameters') display=(noticks noline);&lt;BR /&gt;  xaxis label= %upcase('percent') ;&lt;BR /&gt;run;&lt;BR /&gt;Thank you.</description>
      <pubDate>Thu, 29 Oct 2020 14:29:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695206#M212110</guid>
      <dc:creator>alexgonzalez</dc:creator>
      <dc:date>2020-10-29T14:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Removing SAS warning when using the % sign in a test</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695224#M212120</link>
      <description>&lt;P&gt;The code shown won't run.&lt;/P&gt;
&lt;PRE&gt;label=%upcase('%E from FS.);
output;&lt;/PRE&gt;
&lt;P&gt;Missing a ' will cause problems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you are dealing with literal text skip the %UPCASE function&lt;/P&gt;
&lt;PRE&gt;label='%E FROM FS';&lt;/PRE&gt;
&lt;P&gt;The SAS editor tyically uses ctrl+U to capitalize highlighted text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The %upcase macro function means that things like % and &amp;amp; will get treated differently and it is a separate headache learning about correct usage. Avoid until needed.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 15:03:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695224#M212120</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-10-29T15:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Removing SAS warning when using the % sign in a test</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695234#M212124</link>
      <description>In the previous code also shown below, the missing ' was accidentally deleted when I copied the code from my original code.&lt;BR /&gt;     label=%upcase('%E from FS.);&lt;BR /&gt;    output;&lt;BR /&gt;I removed the %UPCASE function as you suggested and still getting the warning message. &lt;BR /&gt;Additionally, let's say I also want to pass a macro variable into the label as follows:&lt;BR /&gt;label="%E FROM FS in &amp;amp;agesex";&lt;BR /&gt;Thanks a lot BallardW.&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Oct 2020 15:21:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695234#M212124</guid>
      <dc:creator>alexgonzalez</dc:creator>
      <dc:date>2020-10-29T15:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: Removing SAS warning when using the % sign in a test</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695261#M212140</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/152501"&gt;@alexgonzalez&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;In the previous code also shown below, the missing ' was accidentally deleted when I copied the code from my original code.&lt;BR /&gt;label=%upcase('%E from FS.);&lt;BR /&gt;output;&lt;BR /&gt;I removed the %UPCASE function as you suggested and still getting the warning message. &lt;BR /&gt;Additionally, let's say I also want to pass a macro variable into the label as follows:&lt;BR /&gt;label="%E FROM FS in &amp;amp;agesex";&lt;BR /&gt;Thanks a lot BallardW.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The show WHERE the macro value is created. If you don't want the warning to appear then concatenating text prior that step into a single macro variable would be the answer.&lt;/P&gt;
&lt;P&gt;This appears to do what you want without creating the warning messages.&lt;/P&gt;
&lt;PRE&gt;%let agesex = something;
%let string = %nrstr(%E FROM FS IN ) &amp;amp;agesex.;
%put &amp;amp;string;

data junk;
   x=1;
   label x ="&amp;amp;string.";
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Oct 2020 16:20:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695261#M212140</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-10-29T16:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: Removing SAS warning when using the % sign in a test</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695281#M212155</link>
      <description>Sorry BallardW. I tried that, but I keep getting the error message when pass the 'junk' dataset in the SGANNO option in PROC SGPLOT.</description>
      <pubDate>Thu, 29 Oct 2020 17:23:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695281#M212155</guid>
      <dc:creator>alexgonzalez</dc:creator>
      <dc:date>2020-10-29T17:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: Removing SAS warning when using the % sign in a test</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695318#M212168</link>
      <description>&lt;P&gt;You will NOT get a message if you use single quotes around the value. The macro processor ignores macro triggers inside of quoted strings that use single quotes on the outside.&amp;nbsp; So this is fine:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;label=upcase('%E from FS.');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now your new post is probably the code that is giving you the message.&amp;nbsp; If you are doing it in a data step, like the above was used then just split the string into separate strings.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;label='%E FROM FS in ' || "&amp;amp;agesex";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the value of the macro variable AGESEX has % or &amp;amp; and you are using the statement outside of a data step then add some macro quoting. Such as:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let agesex=40 yr old males;
%let label=%nrstr(%'%%)E FROM FS in &amp;amp;agesex%nrstr(%');
%put &amp;amp;=label;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or if you are in a data step use SYMGET() function to retrieve the macro variable's value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;label='%E FROM FS in ' || symget('agesex');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 19:21:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695318#M212168</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-10-29T19:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Removing SAS warning when using the % sign in a test</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695444#M212226</link>
      <description>Hi Tom,&lt;BR /&gt;I tried all your options and still getting the warning message. In the following dataset, it does not 'complain' at all.&lt;BR /&gt;Data anno;&lt;BR /&gt;	  function="text"; &lt;BR /&gt;	  x1space= 'graphpercent';&lt;BR /&gt;	  y1space= 'graphpercent';&lt;BR /&gt;	  width=200;&lt;BR /&gt;	  textweight='bold';&lt;BR /&gt;	  textsize=10;&lt;BR /&gt;	  y1=98.5;&lt;BR /&gt;	  x1=50;&lt;BR /&gt;	label='%E FROM FS IN ' || upcase("&amp;amp;agesex");&lt;BR /&gt;	output;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Nevertheless, when the following PROC SGPLOT procedure is used is when I get it.&lt;BR /&gt;&lt;BR /&gt;proc sgplot data=stats_plot noborder sganno=anno noautolegend;&lt;BR /&gt;  band    y=variable lower=p5 upper=p95 / transparency=0.6;&lt;BR /&gt;  scatter y=variable  x=mean / xerrorlower=p5 &lt;BR /&gt;                               xerrorupper=p95 &lt;BR /&gt;                               markerattrs=(symbol=circlefilled) &lt;BR /&gt;                               transparency=0;&lt;BR /&gt;&lt;BR /&gt;  x2axis display=(noticks nolabel) offsetmin=0.75 offsetmax=0.08;&lt;BR /&gt;&lt;BR /&gt;  scatter y=variable x=x1  / markerchar=mean x2axis;&lt;BR /&gt;  scatter y=variable x=x4  / markerchar=p5   x2axis;&lt;BR /&gt;  scatter y=variable x=x5  / markerchar=p95  x2axis;&lt;BR /&gt;&lt;BR /&gt;	&lt;BR /&gt;  refline 0 / axis=x &lt;BR /&gt;              lineattrs=(thickness=3 &lt;BR /&gt;	          color=blb pattern=dash);&lt;BR /&gt;  yaxis &lt;BR /&gt;    label= %upcase('Distribution parameters') &lt;BR /&gt;	grid offsetmin=0.05 offsetmax=0.05&lt;BR /&gt;    display=(noticks noline) valueattrs=(size=7);&lt;BR /&gt;&lt;BR /&gt;  xaxis &lt;BR /&gt;    label= %upcase('percent differences') &lt;BR /&gt;    grid valueattrs=(size=7)&lt;BR /&gt;	offsetmin=0.1 offsetmax=0.3&lt;BR /&gt;    min=-&amp;amp;p max=&amp;amp;p ;&lt;BR /&gt;run;&lt;BR /&gt;Thanks a lot,&lt;BR /&gt;A.G.&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Oct 2020 12:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695444#M212226</guid>
      <dc:creator>alexgonzalez</dc:creator>
      <dc:date>2020-10-30T12:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Removing SAS warning when using the % sign in a test</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695590#M212275</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the key point is that SGPLOT is doing its own code generation (it has to generate PROC TEMPLATE code in the background).&amp;nbsp; And any time code is being generated, there is the potential for macro triggers to be revealed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This code replicates your problem.&amp;nbsp; As you say, the DATA step does not see %E as a macro call, because it is hidden by the single quotes.&amp;nbsp; However, the PROC SGPLOT does see the % sign as a macro trigger:&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;data anno;
  function="text";
  x1space= 'graphpercent';
  y1space= 'graphpercent';
  y1=50;
  x1=50;
  label='%E FROM FS IN ';
run;

proc sgplot data=sashelp.class sganno=anno tmplout="c:\junk\mytmpl.sas";
 scatter x=height y=weight ;
run ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I added the tmplout= option to the proc, so that you can see the code that SGPLOT generated.&amp;nbsp; You can see that it generates a DRAWTEXT statement for the annotation, and the value is in &lt;EM&gt;&lt;STRONG&gt;double quotes&lt;/STRONG&gt;&lt;/EM&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc template;
define statgraph sgplot;
begingraph / collation=binary;
layout overlay / yaxisopts=(labelFitPolicy=Split) y2axisopts=(labelFitPolicy=Split);
   ScatterPlot X=Height Y=Weight / subpixel=off primary=true LegendLabel="Weight" NAME="SCATTER";
   DrawText  "%E FROM FS IN" / X=50 Y=50 XSPACE=graphpercent YSPACE=graphpercent;
endlayout;
endgraph;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While it looks funny in the DATA step code, one option would be to add %NRSTR() inside the single quotes. This will prevent SGPLOT from seeing the % sign as a macro trigger:&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;data anno;
  function="text";
  x1space= 'graphpercent';
  y1space= 'graphpercent';
  y1=50;
  x1=50;
  label='%nrstr(%E) FROM FS IN ';
run;

proc sgplot data=sashelp.class sganno=anno tmplout="c:\junk\mytmpl2.sas";
 scatter x=height y=weight ;
run ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;because the SGPLOT will generate:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc template;
define statgraph sgplot;
begingraph / collation=binary;
layout overlay / yaxisopts=(labelFitPolicy=Split) y2axisopts=(labelFitPolicy=Split);
   ScatterPlot X=Height Y=Weight / subpixel=off primary=true LegendLabel="Weight" NAME="SCATTER";
   DrawText  "%nrstr(%E) FROM FS IN" / X=50 Y=50 XSPACE=graphpercent YSPACE=graphpercent;
endlayout;
endgraph;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;HTH&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2020 21:09:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695590#M212275</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2020-10-30T21:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Removing SAS warning when using the % sign in a test</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695960#M212474</link>
      <description>Hi Quentin,&lt;BR /&gt;Thanks a lot for the great suggestion. That fixed the issue completely. Very much appreciated. I've dealing with that for a few days.&lt;BR /&gt;A.G.</description>
      <pubDate>Mon, 02 Nov 2020 14:26:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-SAS-warning-when-using-the-sign-in-a-test/m-p/695960#M212474</guid>
      <dc:creator>alexgonzalez</dc:creator>
      <dc:date>2020-11-02T14:26:08Z</dc:date>
    </item>
  </channel>
</rss>

