<?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 Create and use columns as macrovariables within datastep in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-and-use-columns-as-macrovariables-within-datastep/m-p/205776#M38252</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm dealing with the following scenario:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table RULES which contains two character fiels: CONDITION and DESCRIPTION:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;RULE&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;CONDITION&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;DESCRIPTION&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;RULE1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;COL1 &amp;lt; 0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Warning, COL1 CAN'T BE NEGATIVE (current value = &amp;amp;COL1)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;RULE2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;COL1 + COL2 &amp;gt; 100&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Warning, THE SUM COL1+COL2 IS INVALID (current values: &amp;amp;COL1 + &amp;amp;COL2 &amp;gt; 100)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next, I have a table EVENTS which contains some variables:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;COL1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;COL2&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;COL3&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;80&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;40&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;-10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that in RULES.CONDITION I have explicitly the EVENTS columns name; in RULES.DESCRIPTION I have the EVENTS columns name with "&amp;amp;" prefixed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create an OUTPUT table as follows:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;&lt;STRONG&gt;COL1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;&lt;STRONG&gt;COL2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;&lt;STRONG&gt;COL3&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;&lt;STRONG&gt;RULE1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;RULE2&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;RULE1_DESCRIPTION&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;RULE2_DESCRIPTION&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;80&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;40&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;ok&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Warning, THE SUM COL1+COL2 IS INVALID (current values: 80 + 40 &amp;gt; 100)&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;-10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Warning, COL1 CAN'T BE NEGATIVE (current value = -10)&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;ok&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RULE1/2 are easy (I'm using call execute, I sketch the code so there may be mistakes it is just to point the idea out):&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14404251096163936" jivemacro_uid="_14404251096163936"&gt;
&lt;P&gt;data _NULL_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set RULES;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (_N_ = 1) then call execute('data OUTPUT; set EVENTS;);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute(RULE || '= ifn(' || CONDITION || ',1,0);');&lt;/P&gt;
&lt;P&gt;.......&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works perfectly. Now I want to add description, so I tried as before:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; font-family: helvetica, arial;"&gt;call execute(RULE || '_DESCRIPTION = ifn(' || CON&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN style="font-family: helvetica, arial; font-size: 12px;"&gt;DITION&lt;/SPAN&gt;&lt;SPAN style="font-family: helvetica, arial; font-size: 12px;"&gt; || ',' || DESCRIPTION || ','ok);');&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;but this does not resolve macrovariables (of course because they don't exists), so I get e.g. &lt;SPAN style="font-size: 13.3333330154419px;"&gt;Warning, COL1 CAN'T BE NEGATIVE (current value = &amp;amp;COL1).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;But if I try do define them using symput in the same datastep of course I get wrong values.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would you do that in a simple way?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Aug 2015 14:03:02 GMT</pubDate>
    <dc:creator>Edoedoedo</dc:creator>
    <dc:date>2015-08-24T14:03:02Z</dc:date>
    <item>
      <title>Create and use columns as macrovariables within datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-and-use-columns-as-macrovariables-within-datastep/m-p/205776#M38252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm dealing with the following scenario:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table RULES which contains two character fiels: CONDITION and DESCRIPTION:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;RULE&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;CONDITION&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;DESCRIPTION&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;RULE1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;COL1 &amp;lt; 0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Warning, COL1 CAN'T BE NEGATIVE (current value = &amp;amp;COL1)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;RULE2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;COL1 + COL2 &amp;gt; 100&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Warning, THE SUM COL1+COL2 IS INVALID (current values: &amp;amp;COL1 + &amp;amp;COL2 &amp;gt; 100)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next, I have a table EVENTS which contains some variables:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;COL1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;COL2&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;COL3&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;80&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;40&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;-10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that in RULES.CONDITION I have explicitly the EVENTS columns name; in RULES.DESCRIPTION I have the EVENTS columns name with "&amp;amp;" prefixed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create an OUTPUT table as follows:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;&lt;STRONG&gt;COL1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;&lt;STRONG&gt;COL2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;&lt;STRONG&gt;COL3&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;&lt;STRONG&gt;RULE1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;RULE2&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;RULE1_DESCRIPTION&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;RULE2_DESCRIPTION&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;80&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;40&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;ok&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Warning, THE SUM COL1+COL2 IS INVALID (current values: 80 + 40 &amp;gt; 100)&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;-10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Warning, COL1 CAN'T BE NEGATIVE (current value = -10)&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;ok&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RULE1/2 are easy (I'm using call execute, I sketch the code so there may be mistakes it is just to point the idea out):&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14404251096163936" jivemacro_uid="_14404251096163936"&gt;
&lt;P&gt;data _NULL_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set RULES;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (_N_ = 1) then call execute('data OUTPUT; set EVENTS;);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute(RULE || '= ifn(' || CONDITION || ',1,0);');&lt;/P&gt;
&lt;P&gt;.......&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works perfectly. Now I want to add description, so I tried as before:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; font-family: helvetica, arial;"&gt;call execute(RULE || '_DESCRIPTION = ifn(' || CON&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN style="font-family: helvetica, arial; font-size: 12px;"&gt;DITION&lt;/SPAN&gt;&lt;SPAN style="font-family: helvetica, arial; font-size: 12px;"&gt; || ',' || DESCRIPTION || ','ok);');&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;but this does not resolve macrovariables (of course because they don't exists), so I get e.g. &lt;SPAN style="font-size: 13.3333330154419px;"&gt;Warning, COL1 CAN'T BE NEGATIVE (current value = &amp;amp;COL1).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;But if I try do define them using symput in the same datastep of course I get wrong values.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would you do that in a simple way?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 14:03:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-and-use-columns-as-macrovariables-within-datastep/m-p/205776#M38252</guid>
      <dc:creator>Edoedoedo</dc:creator>
      <dc:date>2015-08-24T14:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Create and use columns as macrovariables within datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-and-use-columns-as-macrovariables-within-datastep/m-p/205777#M38253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you have to remember the order of execution in this instance.&amp;nbsp; The call execute generates code which then goes to the compiler, it doesn't then go back through the pre-processor.&amp;nbsp; Instead of puting &amp;amp;COL1 in your description, have some sort of easy to find replacing string, e.g.:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;Warning, COL1 CAN'T BE NEGATIVE (current value = ~COL1~)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;Then have a post-check processing datastep which merely replaces values:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;data final;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set check_output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reason=tranwrd(reason,"~COL1~",strip(put(col1,best.)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reason=tranwrd(reason,"~COL2~",strip(put(col2,best.)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's probably the simplest way.&amp;nbsp; You could also modify your code to call a macro with the data:&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set checks;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute('%my_macro (col1='||put(col1,best.)||', col2='||put(col2,best.)||', check="'||check||'");');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 14:14:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-and-use-columns-as-macrovariables-within-datastep/m-p/205777#M38253</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-08-24T14:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create and use columns as macrovariables within datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-and-use-columns-as-macrovariables-within-datastep/m-p/205778#M38254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here are two pages with programs that address your issues:&lt;/P&gt;&lt;P&gt;how to use a list, a control data set,&lt;/P&gt;&lt;P&gt;to call another program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://www.sascommunity.org/wiki/Call_Execute_Parameterized_Include" title="http://www.sascommunity.org/wiki/Call_Execute_Parameterized_Include"&gt;http://www.sascommunity.org/wiki/Call_Execute_Parameterized_Include&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sascommunity.org/wiki/Macro_CallMacr" title="http://www.sascommunity.org/wiki/Macro_CallMacr"&gt;Macro CallMacr - sasCommunity&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2015 14:55:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-and-use-columns-as-macrovariables-within-datastep/m-p/205778#M38254</guid>
      <dc:creator>Ron_MacroMaven</dc:creator>
      <dc:date>2015-08-25T14:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create and use columns as macrovariables within datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-and-use-columns-as-macrovariables-within-datastep/m-p/205779#M38255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no need to create and use macro variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data rules;&lt;BR /&gt; length condition $25 description $200;&lt;BR /&gt; rule="RULE1";&lt;BR /&gt; condition="COL1 &amp;lt; 0";&lt;BR /&gt; description="'Warning, COL1 CANT BE NEGATIVE (current value = '||STRIP(PUT(COL1,BEST.))||')'";&lt;BR /&gt; output;&lt;BR /&gt; rule="RULE2";&lt;BR /&gt; condition="COL1 + COL2 &amp;gt; 100";&lt;BR /&gt; description="'Warning, THE SUM COL1+COL2 IS INVALID (current values: '||STRIP(PUT(COL1,BEST.))||' + '||STRIP(PUT(COL2,BEST.))||' &amp;gt; 100)'";&lt;BR /&gt; output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt; set rules end=eof;&lt;BR /&gt; if (_n_=1) then call execute('data output; set evnt;');&lt;BR /&gt; call execute(rule||'=ifn('||strip(condition)||',1,0);');&lt;BR /&gt;/* call execute(desc||'=ifn('||strip(rule)||','||desc||',ok);');*/&lt;BR /&gt; call execute(rule || "_description = ifc(" || strip(condition) || "," || strip(description) || ",'Ok');");&lt;BR /&gt; if eof then call execute('run;');&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2015 18:32:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-and-use-columns-as-macrovariables-within-datastep/m-p/205779#M38255</guid>
      <dc:creator>ndp</dc:creator>
      <dc:date>2015-08-25T18:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Create and use columns as macrovariables within datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-and-use-columns-as-macrovariables-within-datastep/m-p/205780#M38256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can trasform it into values before call execute .&lt;/P&gt;&lt;P&gt;Like something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px;"&gt;call execute('temp=tranwrd(" '||&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12px; font-family: helvetica, arial;"&gt;DESCRIPTION||' ","&amp;amp;COL1", COL1); ' );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px;"&gt;call execute('temp=tranwrd(" '||&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12px; font-family: helvetica, arial;"&gt;DESCRIPTION||' ","&amp;amp;COL2", COL2); ' );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px;"&gt;call execute('temp=tranwrd(" '||&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12px; font-family: helvetica, arial;"&gt;DESCRIPTION||' ","&amp;amp;COL3", COL3); ' );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px;"&gt;call execute(RULE || '_DESCRIPTION = ifn(' || CON&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN style="font-family: helvetica, arial; font-size: 12px;"&gt;DITION&lt;/SPAN&gt;&lt;SPAN style="font-family: helvetica, arial; font-size: 12px;"&gt; || ',temp,"ok");');&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;消息编辑者为：xia keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 02:13:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-and-use-columns-as-macrovariables-within-datastep/m-p/205780#M38256</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-08-26T02:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Create and use columns as macrovariables within datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-and-use-columns-as-macrovariables-within-datastep/m-p/205781#M38257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Thanks a lot guys, call execute without macrovariables works fine, it's simple and elegant.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 15:46:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-and-use-columns-as-macrovariables-within-datastep/m-p/205781#M38257</guid>
      <dc:creator>Edoedoedo</dc:creator>
      <dc:date>2015-08-27T15:46:14Z</dc:date>
    </item>
  </channel>
</rss>

