<?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: An unexplained warning with a macro variable. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460993#M284746</link>
    <description>&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;I am using a very specific calculus from an ISO guideline.&lt;/P&gt;
&lt;P&gt;The problem is not about statistics.&lt;/P&gt;
&lt;P&gt;I reformulate my question.&lt;/P&gt;
&lt;P&gt;Why this code works (give the right result 17) but produce a warning?&lt;/P&gt;
&lt;P&gt;%macro mac();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %let i=1;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %let x0=17;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %put %cmpres(&amp;amp;x%eval(&amp;amp;i.-1));&lt;BR /&gt;%mend mac;&lt;BR /&gt;%mac();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 May 2018 13:10:26 GMT</pubDate>
    <dc:creator>Sam28041977</dc:creator>
    <dc:date>2018-05-09T13:10:26Z</dc:date>
    <item>
      <title>An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460935#M284736</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I don't understand why I had a warning when executing this piece of code:&lt;/P&gt;
&lt;P&gt;%do i=1 %to 100;&lt;BR /&gt;%put %cmpres(&amp;amp;x%left(%sysevalf(&amp;amp;i.-1)));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WARNING: Apparent symbolic reference X not resolved.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Even though it gives the right result (X0=17)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I get the same warning result with&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%put %cmpres(&amp;amp;x%eval(&amp;amp;i.-1));&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;Thank you for your help&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 09:43:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460935#M284736</guid>
      <dc:creator>Sam28041977</dc:creator>
      <dc:date>2018-05-09T09:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460936#M284737</link>
      <description>&lt;P&gt;I think its because of missing '.' .use &amp;amp;x. if not resolved try to see other options if the macro variable "X" is declared outside of macro and you are trying to invoke that within a macro.&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 09:41:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460936#M284737</guid>
      <dc:creator>Vish33</dc:creator>
      <dc:date>2018-05-09T09:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460944#M284738</link>
      <description>&lt;P&gt;You have written in your code: &amp;amp;x.&amp;nbsp; This x is a macro variable, denoted by the use of the ampersand.&amp;nbsp; The error is telling you that there is no macro variable called X in existence.&amp;nbsp; Thus it cannot de-reference the macro variable X and just displays the macro variable name X.&amp;nbsp; In the code you present there is no definition of a macro variable X, so why o you have &amp;amp;x?&amp;nbsp; To be honest, this:&lt;/P&gt;
&lt;P&gt;%put %cmpres(&amp;amp;x%left(%sysevalf(&amp;amp;i.-1)));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Looks a bit of a mess anyways, what are you trying to do/achieve?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 10:31:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460944#M284738</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-09T10:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460947#M284739</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;mentioned, there is no such thing as &amp;amp;x in this program.&amp;nbsp; That's where the message is coming from.&amp;nbsp; If you want to get x0 out of this, you could simplify with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put x%eval(&amp;amp;i.-1);&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 10:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460947#M284739</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-09T10:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460956#M284740</link>
      <description>&lt;P&gt;I have X0 (my initial value) and I want to calculate X1,...X100&lt;/P&gt;
&lt;P&gt;it is why I need &amp;amp;X0, &amp;amp;X1, ...&lt;/P&gt;
&lt;P&gt;X1 depend on X0 and X2 depend on X1, ...&lt;/P&gt;
&lt;P&gt;As I mintionned in my email, the code works but I dont understand why given the warning.&lt;/P&gt;
&lt;P&gt;What I provided you is just a small part of the code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the %put is just to reproduce the warning&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 11:16:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460956#M284740</guid>
      <dc:creator>Sam28041977</dc:creator>
      <dc:date>2018-05-09T11:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460957#M284741</link>
      <description>&lt;P&gt;To get the value of &amp;amp;X0, try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put &amp;amp;&amp;amp;x%eval(&amp;amp;i.-1);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 11:25:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460957#M284741</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-09T11:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460959#M284742</link>
      <description>&lt;P&gt;So your creating 100 macro variables, macro is&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;/U&gt; a replacement for Base SAS.&amp;nbsp; If your creating hundreds of data items, then a dataset is where to store that information.&amp;nbsp; If your using more than 2 or 3 macro variables, multiple de-references and %functions, then you should really re-think your problem as I can guarentee that there is a far simpler method of achieving what you want.&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 11:36:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460959#M284742</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-09T11:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460967#M284743</link>
      <description>&lt;P&gt;I am not creating 100 macro variables.&lt;/P&gt;
&lt;P&gt;I am doing robust estimations by iterating until the difference in the estimate i and i-1 is close to 0.&lt;/P&gt;
&lt;P&gt;As I get always this without reaching 100 iteration I fixed the max iteration to 100.&lt;/P&gt;
&lt;P&gt;Only the final estimate interest me.&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 12:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460967#M284743</guid>
      <dc:creator>Sam28041977</dc:creator>
      <dc:date>2018-05-09T12:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460969#M284744</link>
      <description>&lt;P&gt;I already tested it even I didn't believe why it should work better.&lt;/P&gt;
&lt;P&gt;The warning is still present&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 12:07:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460969#M284744</guid>
      <dc:creator>Sam28041977</dc:creator>
      <dc:date>2018-05-09T12:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460974#M284745</link>
      <description>&lt;P&gt;Well, i am not a statistician, so can't guide as I would like, but checking the documentation, there appears to be quite a few examples in the documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/procstat/67528/HTML/default/viewer.htm#procstat_univariate_details22.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/procstat/67528/HTML/default/viewer.htm#procstat_univariate_details22.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 12:23:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460974#M284745</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-09T12:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460993#M284746</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;I am using a very specific calculus from an ISO guideline.&lt;/P&gt;
&lt;P&gt;The problem is not about statistics.&lt;/P&gt;
&lt;P&gt;I reformulate my question.&lt;/P&gt;
&lt;P&gt;Why this code works (give the right result 17) but produce a warning?&lt;/P&gt;
&lt;P&gt;%macro mac();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %let i=1;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %let x0=17;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %put %cmpres(&amp;amp;x%eval(&amp;amp;i.-1));&lt;BR /&gt;%mend mac;&lt;BR /&gt;%mac();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 13:10:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460993#M284746</guid>
      <dc:creator>Sam28041977</dc:creator>
      <dc:date>2018-05-09T13:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460998#M284747</link>
      <description>&lt;P&gt;Probably lost in the confusion of so many messages ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code refers to &amp;amp;X.&amp;nbsp; That means the macro variable X.&amp;nbsp; There is no macro variable X, hence the message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 13:20:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/460998#M284747</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-09T13:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/461009#M284748</link>
      <description>&lt;P&gt;Well, its a real pain, and a very good example of why not use macro language for data processing.&amp;nbsp; However this example does work:&lt;/P&gt;
&lt;PRE&gt;%macro mac();
      %let i=1;
      %let x0=17;
      %let x=x%eval(&amp;amp;i.-1);
     %put &amp;amp;&amp;amp;&amp;amp;x.;
%mend mac;
%mac();&lt;/PRE&gt;
&lt;P&gt;You see how quickly that gets all messy, do it in a datastep, much nicer simpler code.&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 13:36:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/461009#M284748</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-09T13:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/461077#M284749</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13024"&gt;@Sam28041977&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;I am using a very specific calculus from an ISO guideline.&lt;/P&gt;
&lt;P&gt;The problem is not about statistics.&lt;/P&gt;
&lt;P&gt;I reformulate my question.&lt;/P&gt;
&lt;P&gt;Why this code works (give the right result 17) but produce a warning?&lt;/P&gt;
&lt;P&gt;%macro mac();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %let i=1;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %let x0=17;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %put %cmpres(&amp;amp;x%eval(&amp;amp;i.-1));&lt;BR /&gt;%mend mac;&lt;BR /&gt;%mac();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why are you calling the %CMPRES() macro? What do you want to remove?&lt;/P&gt;
&lt;P&gt;To get the macro processor to re-evaluate a macro generated token use multiple &amp;amp;.&amp;nbsp; When it sees two &amp;amp; it converts them to one and sets flag that it needs to re-process the result to resolve more macro variable references.&amp;nbsp; Adding in the %EVAL() causes it to treat the string as multiple tokens instead of one.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I find it is easier to either generate the new number into another macro variable. Or generate the macro variable name into another macro variable and use that to find the value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Play with this example.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let x1=One ;
%let x2=Two ;
%let one=Value of One ;
%let two=Value of Two ;

%let i=1 ;
%put &amp;amp;&amp;amp;x&amp;amp;i ;
%put &amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;x&amp;amp;i ;

%put &amp;amp;&amp;amp;x%eval(&amp;amp;i+1);
%put &amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;x%eval(&amp;amp;i+1) ;

%let j=%eval(&amp;amp;i+1) ;
%put &amp;amp;&amp;amp;x&amp;amp;j ;
%put &amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;x&amp;amp;j ;

%let name=x&amp;amp;i;
%put One=&amp;amp;name Three=&amp;amp;&amp;amp;&amp;amp;name Seven=&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;name  ;

%let name=x%eval(&amp;amp;i+1);
%put One=&amp;amp;name Three=&amp;amp;&amp;amp;&amp;amp;name Seven=&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;name  ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 15:24:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/461077#M284749</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-05-09T15:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/461095#M284750</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13024"&gt;@Sam28041977&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I have X0 (my initial value) and I want to calculate X1,...X100&lt;/P&gt;
&lt;P&gt;it is why I need &amp;amp;X0, &amp;amp;X1, ...&lt;/P&gt;
&lt;P&gt;X1 depend on X0 and X2 depend on X1, ...&lt;/P&gt;
&lt;P&gt;As I mintionned in my email, the code works but I dont understand why given the warning.&lt;/P&gt;
&lt;P&gt;What I provided you is just a small part of the code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the %put is just to reproduce the warning&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Show an actual example of what your are attempting with some values and the desired result.&lt;/P&gt;
&lt;P&gt;I suspect that array processing might work an possibly no macro needed for that part.&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 15:52:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/461095#M284750</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-05-09T15:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/461824#M284751</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;
&lt;P&gt;the algorithme that&amp;nbsp;is described bellow. my full macro is bellow also. the input of the macro is a 2 columns datasets (lab and result). this algorithm detect labs with&amp;nbsp;deviations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 549px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20489i0D0AE94D3705A205/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro prof(var=,data=);
data &amp;amp;data.;
set anadat.&amp;amp;data.;
if &amp;amp;var ne .;
run;
proc means data=&amp;amp;data.;
	where &amp;amp;var. ne .;
	var &amp;amp;var.;
	output out=a median=x;
run;

PROC SQL;
	SELECT x INTO:X0 FROM a;
QUIT;

PROC SQL;
	CREATE TABLE &amp;amp;var. AS SELECT Lab, &amp;amp;var. as &amp;amp;var.0, (ABS(&amp;amp;var.-&amp;amp;x0.)) AS DIFF0 FROM &amp;amp;data.;
QUIT;

proc means data=&amp;amp;var. median;
	var Diff0;
	output out=b median=s;
run;

PROC SQL;
	SELECT (S*1.483) INTO:S0 FROM B;
	SELECT (S*1.483*1.5) INTO:sigma0 FROM B;
QUIT;
DATA &amp;amp;var.S0;
ITER=0;X=ROUND(&amp;amp;X0.,.01);S=ROUND(&amp;amp;S0.,.01); Sigma=ROUND(&amp;amp;sigma0.,.01); 
X_=&amp;amp;X0;S_=&amp;amp;S0; Sigma_=&amp;amp;sigma0; OUTPUT;
RUN;

DATA &amp;amp;VAR.;
SET &amp;amp;VAR.;
DROP DIFF0;
RUN;

%do i=1 %to 100;
%put %cmpres(&amp;amp;&amp;amp;&amp;amp;&amp;amp;x%eval(&amp;amp;i.-1));
data &amp;amp;var.;
	SET &amp;amp;var.;
	if &amp;amp;var.0 ne . and &amp;amp;var.0&amp;lt;(%cmpres(&amp;amp;x%eval(&amp;amp;i.-1))-%cmpres(&amp;amp;sigma%eval(&amp;amp;i.-1))) then &amp;amp;var.&amp;amp;i.=(%cmpres(&amp;amp;x%eval(&amp;amp;i.-1))-%cmpres(&amp;amp;sigma%eval(&amp;amp;i.-1)));
	else if &amp;amp;var.0 ne . and &amp;amp;var.0&amp;gt;(%cmpres(&amp;amp;x%eval(&amp;amp;i.-1))+%cmpres(&amp;amp;sigma%eval(&amp;amp;i.-1))) then &amp;amp;var.&amp;amp;i.=(%cmpres(&amp;amp;x%eval(&amp;amp;i.-1))+%cmpres(&amp;amp;sigma%eval(&amp;amp;i.-1)));
	else if &amp;amp;var.0 ne . then &amp;amp;var.&amp;amp;i.=&amp;amp;var.0;
run;

PROC SQL;
	SELECT mean(&amp;amp;var.&amp;amp;i.) INTO: x&amp;amp;i. FROM &amp;amp;var.;
	SELECT (1.134*std(&amp;amp;var.&amp;amp;i.)) INTO: s&amp;amp;i. FROM &amp;amp;var.;
	SELECT (1.5*1.134*std(&amp;amp;var.&amp;amp;i.)) INTO: sigma&amp;amp;i. FROM &amp;amp;var.;
QUIT;
DATA &amp;amp;var.S&amp;amp;i.;
ITER=&amp;amp;i.;X=ROUND(&amp;amp;&amp;amp;X&amp;amp;i.,.01);S=ROUND(&amp;amp;&amp;amp;S&amp;amp;i.,.01); Sigma=ROUND(&amp;amp;&amp;amp;sigma&amp;amp;i.,.01);
X_=&amp;amp;&amp;amp;X&amp;amp;i.;S_=&amp;amp;&amp;amp;S&amp;amp;i.; Sigma_=&amp;amp;&amp;amp;sigma&amp;amp;i.;OUTPUT;
RUN;
%if &amp;amp;i.&amp;gt;1 %then %Do;
	DATA _NULL_;
		CALL symput ('x_',round(&amp;amp;&amp;amp;x&amp;amp;i.,.01));
		CALL symput ('x__',round(%cmpres(&amp;amp;x%eval(&amp;amp;i.-1)),.01));
		CALL symput ('x___',round(%cmpres(&amp;amp;x%eval(&amp;amp;i.-2)),.01));
		CALL symput ('s_',round(&amp;amp;&amp;amp;s&amp;amp;i.,.01));
		CALL symput ('s__',round(%cmpres(&amp;amp;s%eval(&amp;amp;i.-1)),.01));
		CALL symput ('s___',round(%cmpres(&amp;amp;s%eval(&amp;amp;i.-2)),.01));
	RUN;

	%if (&amp;amp;x_. eq &amp;amp;x__.) and (&amp;amp;s_. eq &amp;amp;s__.) and (&amp;amp;x_. eq &amp;amp;x___.) and (&amp;amp;s_. eq &amp;amp;s___.)%then %do;
	DATA &amp;amp;var._;
		SET &amp;amp;var.;
		FORMAT Z 5.2 Z_ $10. BIAS 5.2 BIAS_ $10. X S 5.2;
		X=&amp;amp;&amp;amp;x&amp;amp;i.;
		S=&amp;amp;&amp;amp;s&amp;amp;i.;
		IF &amp;amp;var.0 NE . THEN Z=(&amp;amp;var.0-&amp;amp;&amp;amp;x&amp;amp;i.)/&amp;amp;&amp;amp;s&amp;amp;i.;
		IF &amp;amp;var.0 NE . THEN BIAS=(&amp;amp;var.0-&amp;amp;&amp;amp;x&amp;amp;i.);
		if Z&amp;lt;-3 or z&amp;gt;3 then DO;
			IF Z NE . THEN Z_=compbl(put(Z,5.2)!!"A");
			IF BIAS NE . THEN BIAS_=compbl(put(BIAS,5.2)!!"A");
		end;
		else if Z&amp;lt;-2 or z&amp;gt;2 then DO;
			IF Z NE . THEN Z_=compbl(put(Z,5.2)!!"W");
			IF BIAS NE . THEN BIAS_=compbl(put(BIAS,5.2)!!"W");
		end;
		else DO;
			Z_=put(Z,5.2);
			BIAS_=put(BIAS,5.2);
		end;
		label Lab="Lab" X="Assigned value (Robust Estimate)" S="Standard Deviation (Robust Estimate)"
			  BIAS="Estimate of Lab Bias" BIAS_="Estimate of Lab Bias (With Flag)"
			  Z="Z Score" Z_="Z Score (With Flag)";
		KEEP Lab &amp;amp;VAR.0 X S BIAS BIAS_ Z Z_;
	run;
	proc sql;
	create table anadat.&amp;amp;var. as select Lab, &amp;amp;var.0, X, S, BIAS, BIAS_, Z, Z_
	from &amp;amp;var._;
	quit;
 
	DATA &amp;amp;var.S;
	SET &amp;amp;var.S0 %do g=1 %to &amp;amp;i.; &amp;amp;var.s&amp;amp;g. %end;;
	RUN;
	%goto exit;
	%end;
%end;
%end;
%exit:
/*proc datasets library=work;
	delete &amp;amp;var.S: S:;
quit; */
%mend prof;
%prof(var=WR10_S,data=%str(DATA));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 May 2018 08:38:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/461824#M284751</guid>
      <dc:creator>Sam28041977</dc:creator>
      <dc:date>2018-05-13T08:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/461852#M284752</link>
      <description>&lt;P&gt;So in some cases, you fixed the problem, changing &amp;amp; to &amp;amp;&amp;amp;.&amp;nbsp; (In one place, you even used &amp;amp;&amp;amp;&amp;amp;&amp;amp; which doesn't hurt anything, since &amp;amp;&amp;amp;&amp;amp;&amp;amp; resolves to &amp;amp;&amp;amp; anyway.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a bunch of other places you left a single &amp;amp; where you require &amp;amp;&amp;amp;.&amp;nbsp; So you are still getting the error message, but macro language is not that helpful in describing where the error occurs.&amp;nbsp; Do you need help in understanding when to change &amp;amp; to &amp;amp;&amp;amp; so that the macro expressions resolve correctly?&lt;/P&gt;</description>
      <pubDate>Sun, 13 May 2018 17:52:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/461852#M284752</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-13T17:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/461951#M284753</link>
      <description>&lt;P&gt;hello Astounding,&lt;/P&gt;
&lt;P&gt;adding &amp;amp; or &amp;amp;&amp;amp; or &amp;amp;&amp;amp;&amp;amp; don't resolved the problem.&lt;/P&gt;
&lt;P&gt;But what I wanted to explain from the begining is that I don't understand the warning because the macros variable resolve correctly whatever the number of &amp;amp;.&lt;/P&gt;
&lt;P&gt;I provided a small macro that show that the result is correct but I still have a warning.&lt;/P&gt;
&lt;P&gt;krs&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 08:15:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/461951#M284753</guid>
      <dc:creator>Sam28041977</dc:creator>
      <dc:date>2018-05-14T08:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: An unexplained warning with a macro variable.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/461972#M284754</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13024"&gt;@Sam28041977&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;hello Astounding,&lt;/P&gt;
&lt;P&gt;adding &amp;amp; or &amp;amp;&amp;amp; or &amp;amp;&amp;amp;&amp;amp; don't resolved the problem.&lt;/P&gt;
&lt;P&gt;But what I wanted to explain from the begining is that I don't understand the warning because the macros variable resolve correctly whatever the number of &amp;amp;.&lt;/P&gt;
&lt;P&gt;I provided a small macro that show that the result is correct but I still have a warning.&lt;/P&gt;
&lt;P&gt;krs&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When the macro processor sees a macro variable reference it replaces the reference with the value of the macro variable.&amp;nbsp; But when you reference a macro variable that doesn't exist the macro processor generates a warning and then DOES NOTHING with the incoming text.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because you are then using the resulting text&amp;nbsp; in a place where the macro processor will re-process the resulting string is why it ultimately generates the desired result.&amp;nbsp; The second time it processes it the macro processor sees a valid macro variable reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can see the same result with code like this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let x2=TWO;

%put &amp;amp;x%eval(1+1);
%Put %unquote(&amp;amp;x%eval(1+1));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 May 2018 10:53:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-unexplained-warning-with-a-macro-variable/m-p/461972#M284754</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-05-14T10:53:03Z</dc:date>
    </item>
  </channel>
</rss>

