<?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 How to code a macro like this? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-a-macro-like-this/m-p/310459#M270707</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am coding to generate a macro for the ods text part, see code below, for the part "&lt;SPAN&gt;item '8&lt;/SPAN&gt;&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;SPAN&gt;% of &lt;/SPAN&gt;&lt;SPAN&gt;total w&lt;/SPAN&gt;&lt;SPAN&gt;ith a &lt;/SPAN&gt;&lt;SPAN&gt;s&lt;/SPAN&gt;&lt;SPAN&gt;core of 700 or greater , up 40 BPS compared to last year", I want to macro&amp;nbsp;8&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;SPAN&gt;% and&amp;nbsp;40, which is when mid=d_2015 then I put&amp;nbsp;exp there, which is 83% then, &amp;nbsp;exp-resp=40BPS, from which I take 40 and put into the ods text content. Would you please help me coding it out? Thanks!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data ds1; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;input year $ mid $ resp exp rev; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;datalines; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_700 d_2016 0.83 0.83 0.47&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_700 d_2015 0.43 0.83 0.47&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc odstext;&lt;BR /&gt;list / style=[color=darkgrey fontsize=2 font_weight=bold ];&lt;/P&gt;&lt;P&gt;item '83% of total with a score of 700 or greater , up 40 BPS compared to last year';&lt;BR /&gt;;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Nov 2016 17:31:29 GMT</pubDate>
    <dc:creator>zhangda</dc:creator>
    <dc:date>2016-11-09T17:31:29Z</dc:date>
    <item>
      <title>How to code a macro like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-a-macro-like-this/m-p/310459#M270707</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am coding to generate a macro for the ods text part, see code below, for the part "&lt;SPAN&gt;item '8&lt;/SPAN&gt;&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;SPAN&gt;% of &lt;/SPAN&gt;&lt;SPAN&gt;total w&lt;/SPAN&gt;&lt;SPAN&gt;ith a &lt;/SPAN&gt;&lt;SPAN&gt;s&lt;/SPAN&gt;&lt;SPAN&gt;core of 700 or greater , up 40 BPS compared to last year", I want to macro&amp;nbsp;8&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;SPAN&gt;% and&amp;nbsp;40, which is when mid=d_2015 then I put&amp;nbsp;exp there, which is 83% then, &amp;nbsp;exp-resp=40BPS, from which I take 40 and put into the ods text content. Would you please help me coding it out? Thanks!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data ds1; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;input year $ mid $ resp exp rev; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;datalines; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_700 d_2016 0.83 0.83 0.47&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_700 d_2015 0.43 0.83 0.47&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc odstext;&lt;BR /&gt;list / style=[color=darkgrey fontsize=2 font_weight=bold ];&lt;/P&gt;&lt;P&gt;item '83% of total with a score of 700 or greater , up 40 BPS compared to last year';&lt;BR /&gt;;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2016 17:31:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-a-macro-like-this/m-p/310459#M270707</guid>
      <dc:creator>zhangda</dc:creator>
      <dc:date>2016-11-09T17:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to code a macro like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-a-macro-like-this/m-p/310467#M270708</link>
      <description>&lt;P&gt;You can build the text to display and write the proper ITEM statements into a file, this can then be %INCLUDE at the proper location in your code. See sample below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename items temp;
data ds1;
input year $ mid $ resp exp rev;
line = catx("*", year, mid, resp, exp, rev);
stmt = catx(" ", "item", quote(strip(line)), ";");
file items;
put stmt;
datalines;
s_700 d_2016 0.83 0.83 0.47
s_700 d_2015 0.43 0.83 0.47
;
run;

 

proc odstext;
list / style=[color=darkgrey fontsize=2 font_weight=bold ];
%include items / source2;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2016 18:01:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-a-macro-like-this/m-p/310467#M270708</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-11-09T18:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to code a macro like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-a-macro-like-this/m-p/310477#M270709</link>
      <description>&lt;P&gt;Hi Bruno,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you please suggest me how to macro the difference between the numbers, which changes very month for example, from the table below,&amp;nbsp;I can get three&amp;nbsp;columns, resp, exp, and rev, the macro named difference is rev&amp;nbsp;minus resp when mid=s_700, &amp;nbsp;thanks a lot!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2016 18:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-a-macro-like-this/m-p/310477#M270709</guid>
      <dc:creator>zhangda</dc:creator>
      <dc:date>2016-11-09T18:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to code a macro like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-a-macro-like-this/m-p/310589#M270710</link>
      <description>&lt;P&gt;You can calculated the difference between a value from the current onservation and the value of a previous observation using the DIF or LAG functions. To format a percentage value you can make use of the PUT function together with the PERCENT. format. The CAT... family of functions allow you to concatenate char values together. Find below a sample program that illustrates the use of these functions. This should help you to get the desired result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds1;
input year $ mid $ resp exp rev;
datalines;
s_700 d_2016 0.83 0.83 0.47
s_700 d_2015 0.43 0.83 0.47
; 

proc sort data=ds1;
  by year mid;
run;

data want;
  set ds1;
  diff_resp = dif1(resp);
  length text $ 256;
  text = catx(" "
    , put(resp, percent9.)
    , "of total of score with 700 or greater, up"
    , diff_resp * 100 
    , "BPS compared to last year"
  );
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2016 08:25:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-a-macro-like-this/m-p/310589#M270710</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-11-10T08:25:45Z</dc:date>
    </item>
  </channel>
</rss>

