<?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 in proc report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-in-proc-report/m-p/905268#M357566</link>
    <description>&lt;P&gt;This has an error&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;        top_tx_min_cible_&amp;amp;var = tx_min_cible_&amp;amp;var.sum;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It should say&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;        top_tx_min_cible_&amp;amp;var = tx_min_cible_&amp;amp;var..sum;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note there must be two dots after &amp;amp;var on the right hand side of the equal sign, one dot to end the name of the macro variable, and one dot to indicate the dot that PROC REPORT requires in this situation before the word SUM. You need to fix this throughout your code.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;From now on when you get an error in code, you MUST (it is not optional) show us the entire log for this PROC, every single line in the log for this PROC, not just the error messages. If the above still doesn't fix your problem, we need to see the ENTIRE log for this PROC, not just the error messages. In addition, you should turn on macro debugging tools by running this line of code before you run the macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 29 Nov 2023 22:09:48 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-11-29T22:09:48Z</dc:date>
    <item>
      <title>Macro in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-in-proc-report/m-p/905264#M357562</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;SPAN class="Y2IQFc"&gt;I'm coming back to you because I'm stuck. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;I want to use a macro variable to feed my compute columns (top_tx_min_cible_&amp;amp;var) but I think I am using the macro incorrectly (the order of my instructions may be wrong?!!)&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;I have a 50 computed column hence my need for a macro variable.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;I don't want to&amp;nbsp;use 50 compute blocks like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;For information, I used this&amp;nbsp;treatment without the macro to test on a few columns and it works.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;compute top_tx_min_cible_&lt;STRONG&gt;A&lt;/STRONG&gt;;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; top_tx_min_cible_&lt;STRONG&gt;A&lt;/STRONG&gt; = tx_min_cible_&lt;STRONG&gt;A&lt;/STRONG&gt;.sum;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; endcomp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; compute top_tx_max_cible_&lt;STRONG&gt;A&lt;/STRONG&gt;;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; top_tx_max_cible_&lt;STRONG&gt;A&lt;/STRONG&gt;= tx_max_cible_&lt;STRONG&gt;A&lt;/STRONG&gt;.sum;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; endcomp;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; compute top_tx_min_temoin_&lt;STRONG&gt;A&lt;/STRONG&gt;;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; top_tx_min_temoin_&lt;STRONG&gt;A&lt;/STRONG&gt; = tx_min_temoin_&lt;STRONG&gt;A&lt;/STRONG&gt;.sum;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; endcomp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; compute top_tx_max_temoin_&lt;STRONG&gt;A&lt;/STRONG&gt;;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; top_tx_max_temoin_&lt;STRONG&gt;A&lt;/STRONG&gt; = tx_max_temoin_&lt;STRONG&gt;A&lt;/STRONG&gt;.sum;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; endcomp;&lt;/P&gt;
&lt;PRE&gt;%macro calc_top_sum(var);

    compute top_tx_min_cible_&amp;amp;var;
        top_tx_min_cible_&amp;amp;var = tx_min_cible_&amp;amp;var.sum;
    endcomp;


    compute top_tx_max_cible_&amp;amp;var;
        top_tx_max_cible_&amp;amp;var = tx_max_cible_&amp;amp;var.sum;
    endcomp;


    compute top_tx_min_temoin_&amp;amp;var;
        top_tx_min_temoin_&amp;amp;var = tx_min_temoin_&amp;amp;var.sum;
    endcomp;

   
    compute top_tx_max_temoin_&amp;amp;var;
        top_tx_max_temoin_&amp;amp;var = tx_max_temoin_&amp;amp;var.sum;
    endcomp;
%mend calc_top_sum;

PROC REPORT ;
COLUMN …….

define  tx_min_cible_A /analysis ;
define  tx_max_cible_A /analysis ;
define  tx_min_temoin_A /analysis ;
define  tx_max_temoin_A/analysis ;

define  TOP_tx_max_temoin_A   /computed ;
define  TOP_tx_min_temoin_A  /computed ;
define  TOP_tx_max_cible_A  /computed ;
define  TOP_tx_min_cible_A /computed ;

define  tx_min_cible_B /analysis ;
define  tx_max_cible_B /analysis ;
define  tx_min_temoin_B /analysis ;
define  tx_max_temoin_B/analysis ;

define  TOP_tx_max_temoin_B   /computed ;
define  TOP_tx_min_temoin_B  /computed ;
define  TOP_tx_max_cible_B  /computed ;
define  TOP_tx_min_cible_B /computed ;


define  tx_min_cible_C /analysis ;
define  tx_max_cible_C /analysis ;
define  tx_min_temoin_C /analysis ;
define  tx_max_temoin_C/analysis ;

define  TOP_tx_max_temoin_C   /computed ;
define  TOP_tx_min_temoin_C  /computed ;
define  TOP_tx_max_cible_C  /computed ;
define  TOP_tx_min_cible_C /computed ;
.
.
.
.
%calc_top_sum(A); 
%calc_top_sum(B); 
%calc_top_sum(C); 
.
.
.
.
BREAK AFTER……
RUN ;

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank's&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 21:07:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-in-proc-report/m-p/905264#M357562</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-11-29T21:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Macro in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-in-proc-report/m-p/905268#M357566</link>
      <description>&lt;P&gt;This has an error&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;        top_tx_min_cible_&amp;amp;var = tx_min_cible_&amp;amp;var.sum;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It should say&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;        top_tx_min_cible_&amp;amp;var = tx_min_cible_&amp;amp;var..sum;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note there must be two dots after &amp;amp;var on the right hand side of the equal sign, one dot to end the name of the macro variable, and one dot to indicate the dot that PROC REPORT requires in this situation before the word SUM. You need to fix this throughout your code.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;From now on when you get an error in code, you MUST (it is not optional) show us the entire log for this PROC, every single line in the log for this PROC, not just the error messages. If the above still doesn't fix your problem, we need to see the ENTIRE log for this PROC, not just the error messages. In addition, you should turn on macro debugging tools by running this line of code before you run the macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Nov 2023 22:09:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-in-proc-report/m-p/905268#M357566</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-29T22:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: Macro in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-in-proc-report/m-p/905269#M357567</link>
      <description>Hi:&lt;BR /&gt;  In addition, you do NOT show your entire COLUMN statement. Do you use any ACROSS variables? Are any of your ANALYSIS or COMPUTED items under an ACROSS variable? The only scenario that will work with the statements as you show them is if there are NOT any ACROSS variables used with these ANALYSIS or COMPUTED items.&lt;BR /&gt;Cynthia</description>
      <pubDate>Wed, 29 Nov 2023 22:19:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-in-proc-report/m-p/905269#M357567</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2023-11-29T22:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Macro in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-in-proc-report/m-p/905450#M357633</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Y2IQFc"&gt;I have the same problem with that...&amp;nbsp;with error ERROR: Invalid column specification in CALL DEFINE. I can't find the error&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt; /*SIGN_&amp;amp;var ===&amp;gt; display AND gaint_&amp;amp;var IS ANALYSIS */&lt;BR /&gt;%macro apply_style_sign(var);
 compute SIGN_&amp;amp;var; 

   if SIGN_&amp;amp;var=1 and gaint_&amp;amp;var..sum &amp;gt;0 then do; 
        call define( 'gaint_&amp;amp;var.sum' , "style", "style=[background=#C4D79B]" );
    end;

    else if SIGN_&amp;amp;var=1 and gaint_&amp;amp;var..sum &amp;lt;=0 then do;   
        call define( 'gaint_&amp;amp;var.sum' , "style", "style=[background=#FABF8F]" );
    end;
endcomp;
%mend apply_style_sign;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 21:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-in-proc-report/m-p/905450#M357633</guid>
      <dc:creator>snip</dc:creator>
      <dc:date>2023-11-30T21:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Macro in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-in-proc-report/m-p/905501#M357654</link>
      <description>Hi:&lt;BR /&gt;  Just a thought. Macro variable references cannot be resolved in single quotes. So every place that you reference 'gaint_&amp;amp;var..sum' you will need to change the code to "&amp;amp;gaint_&amp;amp;var..sum" or otherwise, PROC REPORT will not be able to get a valid variable name at resolution time.&lt;BR /&gt;Cynthia</description>
      <pubDate>Fri, 01 Dec 2023 02:21:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-in-proc-report/m-p/905501#M357654</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2023-12-01T02:21:02Z</dc:date>
    </item>
  </channel>
</rss>

