<?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: How to macro the code? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-macro-the-code/m-p/296193#M60182</link>
    <description>&lt;P&gt;As much as I see you are repeating same lines few times except the &lt;STRONG&gt;COMPUTE&lt;/STRONG&gt; argument.&lt;/P&gt;&lt;P&gt;you can define:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %macro comp(arg);&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;compute &amp;amp;arg; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; If _name_='Application'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','comma20.0');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; If _name_='CreditAR'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if _name_= 'JudgmentalAR' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if _name_= 'Referral % ' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;%mend common_lines;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then change your code to:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;Proc&lt;/STRONG&gt; &lt;STRONG&gt;report&lt;/STRONG&gt;&lt;SPAN&gt; data=final &amp;nbsp;contents="&amp;nbsp;&amp;nbsp; " nowd split='\'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .... enter your code here upto ...&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %comp(year2015);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %comp(year2016);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %comp(&lt;SPAN&gt; Num_of_Variance);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %comp(mature2015);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;%comp(&lt;SPAN&gt; Num_of_Variance2);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;RUN&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 02 Sep 2016 18:40:53 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2016-09-02T18:40:53Z</dc:date>
    <item>
      <title>How to macro the code?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-macro-the-code/m-p/296135#M60181</link>
      <description>&lt;P&gt;Hello, can you tell me how to macro the following code, &amp;nbsp;two parts, first, the dataset, &amp;nbsp;I have&amp;nbsp;&amp;nbsp;to report dozens of same datasets, and add&amp;nbsp;&lt;SPAN&gt;ods pdf startpage=no to separate them,&amp;nbsp;second, the variables, you can see the 'compute year2016' part, I have to repeat&amp;nbsp;5 times for each dataset, would you please help me to simplify the code? thank you so much!&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;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Proc&lt;/STRONG&gt; &lt;STRONG&gt;report&lt;/STRONG&gt; data=final &amp;nbsp;contents="&amp;nbsp;&amp;nbsp; " nowd split='\'&lt;/P&gt;&lt;P&gt;style(report)={font_size=&lt;STRONG&gt;14&lt;/STRONG&gt;pt cellpadding=&lt;STRONG&gt;4&lt;/STRONG&gt;pt cellspacing=&lt;STRONG&gt;1&lt;/STRONG&gt; rules=none frame=void}&lt;/P&gt;&lt;P&gt;style(header)={color=white background=cornflowerblue fontsize=&lt;STRONG&gt;14&lt;/STRONG&gt;pt}&lt;/P&gt;&lt;P&gt;style(column)={just=center background=snow foreground=black fontsize=&lt;STRONG&gt;13&lt;/STRONG&gt;pt};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;column _name_&amp;nbsp;&amp;nbsp; year2016&amp;nbsp; year2015&amp;nbsp;&amp;nbsp; Num_of_Variance mature2015&amp;nbsp; Num_of_Variance2 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;define _name_ / "Metrics"&amp;nbsp;&amp;nbsp; style=[foreground=negfmt.];&lt;/P&gt;&lt;P&gt;define year2016/&amp;nbsp; "&amp;amp;Mar_Yr."&amp;nbsp; style=[foreground=negfmt.];&lt;/P&gt;&lt;P&gt;define year2015/&amp;nbsp; " &amp;amp;Mar_PreYr." style=[foreground=negfmt.];&lt;/P&gt;&lt;P&gt;define Num_of_Variance/&amp;nbsp; "#Variance"&amp;nbsp; style=[foreground=negfmt.];&lt;/P&gt;&lt;P&gt;define mature2015/&amp;nbsp; "Mature &amp;amp;Mar_PreYr."&amp;nbsp; style=[foreground=negfmt.];&lt;/P&gt;&lt;P&gt;define Num_of_Variance2/&amp;nbsp; "#Variance"&amp;nbsp; style=[foreground=negfmt.];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute _name_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'Avg FICO'&amp;nbsp; then call define(_row_,'style','style={background=gainsboro}');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'Avg&amp;nbsp; Approve FICO'&amp;nbsp; then call define(_row_,'style','style={background=gainsboro}');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute year2016 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='Application'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','comma20.0');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='CreditAR'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'JudgmentalAR' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'Referral % ' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute year2015 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='Application'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','comma20.0');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='CreditAR'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'JudgmentalAR' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'Referral % ' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute Num_of_Variance ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='Application'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','comma20.0');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='CreditAR'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'JudgmentalAR' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'Referral % ' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute mature2015 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='Application'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','comma20.0');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='CreditAR'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'JudgmentalAR' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'Referral % ' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute Num_of_Variance2 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='Application'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','comma20.0');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='CreditAR'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'JudgmentalAR' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'Referral % ' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;endcomp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods pdf startpage=no;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Proc&lt;/STRONG&gt; &lt;STRONG&gt;report&lt;/STRONG&gt; data=final_ytd&amp;nbsp; contents="&amp;nbsp;&amp;nbsp; " nowd split='\'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;style(report)={font_size=&lt;STRONG&gt;14&lt;/STRONG&gt;pt cellpadding=&lt;STRONG&gt;4&lt;/STRONG&gt;pt cellspacing=&lt;STRONG&gt;1&lt;/STRONG&gt; rules=none frame=void}&lt;/P&gt;&lt;P&gt;style(header)={color=white background=cornflowerblue fontsize=&lt;STRONG&gt;14&lt;/STRONG&gt;pt}&lt;/P&gt;&lt;P&gt;style(column)={just=center background=snow foreground=black fontsize=&lt;STRONG&gt;13&lt;/STRONG&gt;pt};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;column _name_&amp;nbsp;&amp;nbsp; year2016&amp;nbsp; year2015&amp;nbsp;&amp;nbsp; Num_of_Variance mature2015&amp;nbsp; Num_of_Variance2 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;define _name_ / "Metrics"&amp;nbsp;&amp;nbsp; style=[foreground=negfmt.];&lt;/P&gt;&lt;P&gt;define year2016/&amp;nbsp; "YTD&amp;amp;Yr."&amp;nbsp; style=[foreground=negfmt.];&lt;/P&gt;&lt;P&gt;define year2015/&amp;nbsp; " YTD&amp;amp;PreYr." style=[foreground=negfmt.];&lt;/P&gt;&lt;P&gt;define Num_of_Variance/&amp;nbsp; "#Variance"&amp;nbsp; style=[foreground=negfmt.];&lt;/P&gt;&lt;P&gt;define mature2015/&amp;nbsp; "Mature YTD&amp;amp;PreYr."&amp;nbsp; style=[foreground=negfmt.];&lt;/P&gt;&lt;P&gt;define Num_of_Variance2/&amp;nbsp; "#Variance"&amp;nbsp; style=[foreground=negfmt.];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute _name_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'Avg FICO'&amp;nbsp; then call define(_row_,'style','style={background=gainsboro}');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'Avg&amp;nbsp; Approve FICO'&amp;nbsp; then call define(_row_,'style','style={background=gainsboro}');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;endcomp;&lt;/P&gt;&lt;P&gt;compute year2016 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='Application'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','comma20.0');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='CreditAR'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'JudgmentalAR' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'Referral % ' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute year2015 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='Application'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','comma20.0');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='CreditAR'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'JudgmentalAR' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'Referral % ' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute Num_of_Variance ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='Application'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','comma20.0');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='CreditAR'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'JudgmentalAR' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'Referral % ' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute mature2015 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='Application'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','comma20.0');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='CreditAR'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'JudgmentalAR' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'Referral % ' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute Num_of_Variance2 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='Application'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','comma20.0');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If _name_='CreditAR'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'JudgmentalAR' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _name_= 'Referral % ' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;endcomp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2016 15:01:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-macro-the-code/m-p/296135#M60181</guid>
      <dc:creator>zhangda</dc:creator>
      <dc:date>2016-09-02T15:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to macro the code?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-macro-the-code/m-p/296193#M60182</link>
      <description>&lt;P&gt;As much as I see you are repeating same lines few times except the &lt;STRONG&gt;COMPUTE&lt;/STRONG&gt; argument.&lt;/P&gt;&lt;P&gt;you can define:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %macro comp(arg);&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;compute &amp;amp;arg; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; If _name_='Application'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','comma20.0');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; If _name_='CreditAR'&amp;nbsp;&amp;nbsp; then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if _name_= 'JudgmentalAR' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if _name_= 'Referral % ' then call define(_col_,'format','percent8.1');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;%mend common_lines;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then change your code to:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;Proc&lt;/STRONG&gt; &lt;STRONG&gt;report&lt;/STRONG&gt;&lt;SPAN&gt; data=final &amp;nbsp;contents="&amp;nbsp;&amp;nbsp; " nowd split='\'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .... enter your code here upto ...&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %comp(year2015);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %comp(year2016);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %comp(&lt;SPAN&gt; Num_of_Variance);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %comp(mature2015);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;%comp(&lt;SPAN&gt; Num_of_Variance2);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;RUN&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2016 18:40:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-macro-the-code/m-p/296193#M60182</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-09-02T18:40:53Z</dc:date>
    </item>
  </channel>
</rss>

