<?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 Blank spaces with multiple ampersand macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Blank-spaces-with-multiple-ampersand-macro-variable/m-p/563679#M158046</link>
    <description>&lt;P&gt;With the below code I'm having a weird behaviour in the log. According to the ampersand logics, the sequence of compilation for the macro variable derived from the combination&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;fix2&amp;amp;&amp;amp;&amp;amp;prefix&amp;amp;i&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;should be the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;amp;&amp;amp;&amp;amp;fix2&amp;amp;life0&amp;gt;&amp;amp;p95within0&amp;gt;720.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However in the log of the code below blank spaces are filled in the step where, according to compilation logics, the code should execute the macro variable &amp;amp;p95within0. I need to understand why the compiler is not executing the last macro, filling blanks between the number "0" and the "p95within" prefix&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro lapses;

%let fix2=p95within;

%do i=1 %to &amp;amp;dist;

proc sort data=not_assigned%cmpres(&amp;amp;&amp;amp;&amp;amp;prefix&amp;amp;i);
by account_id interaction_status_date;
run;


/*** separate sequence using within quantiles ****/
/** count variable created represent the sequence number **/

data not_assigned%cmpres(&amp;amp;&amp;amp;&amp;amp;prefix&amp;amp;i) (drop=lag_prev) ;
set not_assigned%cmpres(&amp;amp;&amp;amp;&amp;amp;prefix&amp;amp;i) ;
format lag_prev date9.;

by account_id ;

lag_prev=lag(prev_inter);

if first.account_id then count=1;

/** if greater the lapse than q95 BUT same date as previous interaction then do
not increase sequence **/

else if lapse_inter_prev &amp;gt; &amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;fix2&amp;amp;&amp;amp;&amp;amp;prefix&amp;amp;i and 
lag_prev^=prev_inter then count+1;

run;

%end;

%mend lapses;

%lapses;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;/************ LOG ******************/&lt;BR /&gt;&lt;BR /&gt;
MLOGIC(LEFT):  Ending execution.
MLOGIC(CMPRES):  Ending execution.
MPRINT(LAPSES):   not_assigned0 ;
MPRINT(LAPSES):   format lag_prev date9.;
MPRINT(LAPSES):   by account_id ;
MPRINT(LAPSES):   lag_prev=lag(prev_inter);
MPRINT(LAPSES):   if first.account_id then count=1;
SYMBOLGEN:  &amp;amp;&amp;amp; resolves to &amp;amp;.
SYMBOLGEN:  &amp;amp;&amp;amp; resolves to &amp;amp;.
SYMBOLGEN:  &amp;amp;&amp;amp; resolves to &amp;amp;.
SYMBOLGEN:  &amp;amp;&amp;amp; resolves to &amp;amp;.
SYMBOLGEN:  Macro variable PREFIX resolves to life
SYMBOLGEN:  Macro variable I resolves to 1
SYMBOLGEN:  &amp;amp;&amp;amp; resolves to &amp;amp;.
SYMBOLGEN:  Macro variable FIX2 resolves to p95within
SYMBOLGEN:  Macro variable LIFE1 resolves to        0
NOTE: Line generated by the macro variable "LIFE1".
64          &amp;amp;p95within       0
            _
            390
            200
            76
WARNING: Apparent symbolic reference P95WITHIN not resolved.
MPRINT(LAPSES):   else if lapse_inter_prev &amp;gt; &amp;amp;p95within 0 and lag_prev^=prev_inter then count+1;
MPRINT(LAPSES):   run;

ERROR 390-185: Expecting an relational or arithmetic operator.

ERROR 200-322: The symbol is not recognized and will be ignored.

ERROR 76-322: Syntax error, statement will be ignored.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jun 2019 11:37:51 GMT</pubDate>
    <dc:creator>dcortell</dc:creator>
    <dc:date>2019-06-05T11:37:51Z</dc:date>
    <item>
      <title>Blank spaces with multiple ampersand macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Blank-spaces-with-multiple-ampersand-macro-variable/m-p/563679#M158046</link>
      <description>&lt;P&gt;With the below code I'm having a weird behaviour in the log. According to the ampersand logics, the sequence of compilation for the macro variable derived from the combination&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;fix2&amp;amp;&amp;amp;&amp;amp;prefix&amp;amp;i&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;should be the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;amp;&amp;amp;&amp;amp;fix2&amp;amp;life0&amp;gt;&amp;amp;p95within0&amp;gt;720.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However in the log of the code below blank spaces are filled in the step where, according to compilation logics, the code should execute the macro variable &amp;amp;p95within0. I need to understand why the compiler is not executing the last macro, filling blanks between the number "0" and the "p95within" prefix&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro lapses;

%let fix2=p95within;

%do i=1 %to &amp;amp;dist;

proc sort data=not_assigned%cmpres(&amp;amp;&amp;amp;&amp;amp;prefix&amp;amp;i);
by account_id interaction_status_date;
run;


/*** separate sequence using within quantiles ****/
/** count variable created represent the sequence number **/

data not_assigned%cmpres(&amp;amp;&amp;amp;&amp;amp;prefix&amp;amp;i) (drop=lag_prev) ;
set not_assigned%cmpres(&amp;amp;&amp;amp;&amp;amp;prefix&amp;amp;i) ;
format lag_prev date9.;

by account_id ;

lag_prev=lag(prev_inter);

if first.account_id then count=1;

/** if greater the lapse than q95 BUT same date as previous interaction then do
not increase sequence **/

else if lapse_inter_prev &amp;gt; &amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;fix2&amp;amp;&amp;amp;&amp;amp;prefix&amp;amp;i and 
lag_prev^=prev_inter then count+1;

run;

%end;

%mend lapses;

%lapses;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;/************ LOG ******************/&lt;BR /&gt;&lt;BR /&gt;
MLOGIC(LEFT):  Ending execution.
MLOGIC(CMPRES):  Ending execution.
MPRINT(LAPSES):   not_assigned0 ;
MPRINT(LAPSES):   format lag_prev date9.;
MPRINT(LAPSES):   by account_id ;
MPRINT(LAPSES):   lag_prev=lag(prev_inter);
MPRINT(LAPSES):   if first.account_id then count=1;
SYMBOLGEN:  &amp;amp;&amp;amp; resolves to &amp;amp;.
SYMBOLGEN:  &amp;amp;&amp;amp; resolves to &amp;amp;.
SYMBOLGEN:  &amp;amp;&amp;amp; resolves to &amp;amp;.
SYMBOLGEN:  &amp;amp;&amp;amp; resolves to &amp;amp;.
SYMBOLGEN:  Macro variable PREFIX resolves to life
SYMBOLGEN:  Macro variable I resolves to 1
SYMBOLGEN:  &amp;amp;&amp;amp; resolves to &amp;amp;.
SYMBOLGEN:  Macro variable FIX2 resolves to p95within
SYMBOLGEN:  Macro variable LIFE1 resolves to        0
NOTE: Line generated by the macro variable "LIFE1".
64          &amp;amp;p95within       0
            _
            390
            200
            76
WARNING: Apparent symbolic reference P95WITHIN not resolved.
MPRINT(LAPSES):   else if lapse_inter_prev &amp;gt; &amp;amp;p95within 0 and lag_prev^=prev_inter then count+1;
MPRINT(LAPSES):   run;

ERROR 390-185: Expecting an relational or arithmetic operator.

ERROR 200-322: The symbol is not recognized and will be ignored.

ERROR 76-322: Syntax error, statement will be ignored.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2019 11:37:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Blank-spaces-with-multiple-ampersand-macro-variable/m-p/563679#M158046</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2019-06-05T11:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Blank spaces with multiple ampersand macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Blank-spaces-with-multiple-ampersand-macro-variable/m-p/563695#M158054</link>
      <description>&lt;P&gt;This&lt;/P&gt;
&lt;PRE&gt;SYMBOLGEN:  Macro variable LIFE1 resolves to        0
&lt;/PRE&gt;
&lt;P&gt;is your clue. &amp;amp;life1 contains the blanks. Make sure that it does not contain leading blanks by either doing&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let life1=&amp;amp;life1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;somewhere before you use it, or by using either the strip() or left() function (or the call symputx() routine) when creating it.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2019 13:31:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Blank-spaces-with-multiple-ampersand-macro-variable/m-p/563695#M158054</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-05T13:31:45Z</dc:date>
    </item>
  </channel>
</rss>

