<?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: proc report-write code many times in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-report-write-code-many-times/m-p/601339#M173926</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You wrote 'data' instead of '%macro'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you cannot display the macro code with a simple %put as it contains semi columns&lt;/P&gt;
&lt;P&gt;(you can use %quote to prevent them from being interpreted).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Nov 2019 10:43:29 GMT</pubDate>
    <dc:creator>gamotte</dc:creator>
    <dc:date>2019-11-04T10:43:29Z</dc:date>
    <item>
      <title>proc report-write code many times</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-write-code-many-times/m-p/601333#M173921</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to get list of code that will appear many times in proc report (for multiple &amp;amp;mj values)&lt;/P&gt;
&lt;P&gt;I get an error&lt;/P&gt;
&lt;P&gt;ERROR: The %DO statement is not valid in open code.&lt;/P&gt;
&lt;P&gt;Note: I would like to run %&lt;CODE class=" language-sas"&gt;mmmacro&amp;nbsp; within proc report (use short code instead of many lines)&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro  mmmacro;
%do j=0 %to &amp;amp;nn.;
compute mon_&amp;amp;&amp;amp;m&amp;amp;j..;
if mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;gt;UCL1 and mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;gt;UCL2 then call define(_col_,"style","style={background=red}");
else if mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;gt;UCL1 and mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;lt;=UCL2 then call define(_col_,"style","style={background=lightred}");
else if mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;lt;=UCL1 and mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;gt;UCL2 then call define(_col_,"style","style={background=pink}");
endcomp;
%end;
%mend mmmacro;
%put %mmmacro; 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 10:54:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-write-code-many-times/m-p/601333#M173921</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-11-04T10:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: proc report-write code many times</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-write-code-many-times/m-p/601335#M173923</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;I see that you've posted 5 different questions within the last hour.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I see a question on the community, I rely on the asker to have investigated the problem him/herself before posting. Is that the case? Did you spend some time Googling around or search the community for a solution to all of your questions before asking?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't get me wrong. It's great that you post questions and absorb knowledge from the answers you get &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; And people on here love to share knowledge and answer questions. However, most users want you to help yourself before we do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 10:36:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-write-code-many-times/m-p/601335#M173923</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-04T10:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: proc report-write code many times</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-write-code-many-times/m-p/601339#M173926</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You wrote 'data' instead of '%macro'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you cannot display the macro code with a simple %put as it contains semi columns&lt;/P&gt;
&lt;P&gt;(you can use %quote to prevent them from being interpreted).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 10:43:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-write-code-many-times/m-p/601339#M173926</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-11-04T10:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc report-write code many times</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-write-code-many-times/m-p/601342#M173929</link>
      <description>&lt;P&gt;Sorry,&lt;/P&gt;
&lt;P&gt;I have correct it but still get an error.&lt;/P&gt;
&lt;P&gt;I understand that the reason for error is using semicolon (;)&lt;/P&gt;
&lt;P&gt;What is the way to solve it please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro  mmmacro;
%do j=0 %to &amp;amp;nn.;
compute mon_&amp;amp;&amp;amp;m&amp;amp;j..;
if mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;gt;UCL1 and mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;gt;UCL2 then call define(_col_,"style","style={background=red}");
else if mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;gt;UCL1 and mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;lt;=UCL2 then call define(_col_,"style","style={background=lightred}");
else if mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;lt;=UCL1 and mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;gt;UCL2 then call define(_col_,"style","style={background=pink}");
endcomp;
%end;
%mend mmmacro;
%put %mmmacro; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Nov 2019 10:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-write-code-many-times/m-p/601342#M173929</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-11-04T10:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: proc report-write code many times</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-write-code-many-times/m-p/601426#M173959</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Sorry,&lt;/P&gt;
&lt;P&gt;I have correct it but still get an error.&lt;/P&gt;
&lt;P&gt;I understand that the reason for error is using semicolon (;)&lt;/P&gt;
&lt;P&gt;What is the way to solve it please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro  mmmacro;
%do j=0 %to &amp;amp;nn.;
compute mon_&amp;amp;&amp;amp;m&amp;amp;j..;
if mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;gt;UCL1 and mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;gt;UCL2 then call define(_col_,"style","style={background=red}");
else if mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;gt;UCL1 and mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;lt;=UCL2 then call define(_col_,"style","style={background=lightred}");
else if mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;lt;=UCL1 and mon_&amp;amp;&amp;amp;m&amp;amp;j..&amp;gt;UCL2 then call define(_col_,"style","style={background=pink}");
endcomp;
%end;
%mend mmmacro;
%put %mmmacro; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When you are comparing this many values, implied by having &amp;amp;m and &amp;amp;j macro variables,&amp;nbsp;I suggest that it may be time to look into the Report Writing Interface instead of proc report. You can use all of the array tools to examine values and set cell styles and likely not have to result to macro codding at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if the MON_ variable name implies "month" it may be that your data is structured poorly, having multiple variables with one per month instead of a single date value in long form and using the date as an "across" variable and a single analysis/report value associated with each date.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 16:23:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-write-code-many-times/m-p/601426#M173959</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-04T16:23:19Z</dc:date>
    </item>
  </channel>
</rss>

