<?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 update the dataset with the new macro call in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-the-dataset-with-the-new-macro-call/m-p/443719#M111033</link>
    <description>&lt;P&gt;I am using the below macro code(using it as i want the same variable name from 2 different dataset).&lt;/P&gt;
&lt;PRE&gt;%macro EOex(inp=,testvar=);
data EO;
   set EOex.&amp;amp;inp.;
   EOTEST=upcase(cats(substr(&amp;amp;testvar,1,4),substr(&amp;amp;testvar,length(&amp;amp;testvar)-1)));
   EOCAT=upcase(scan(&amp;amp;testvar,1));
run;
%mend;
%EOex(inp=EO_incl,testvar=EOi_std);
%EOex(inp=EO_excl,testvar=EOe_std);
&lt;/PRE&gt;
&lt;P&gt;But if i use it then it will just give me the last call and not the set of 2 calls. How can i set them in the same program?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help&lt;/P&gt;</description>
    <pubDate>Thu, 08 Mar 2018 12:03:59 GMT</pubDate>
    <dc:creator>vraj1</dc:creator>
    <dc:date>2018-03-08T12:03:59Z</dc:date>
    <item>
      <title>how to update the dataset with the new macro call</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-the-dataset-with-the-new-macro-call/m-p/443719#M111033</link>
      <description>&lt;P&gt;I am using the below macro code(using it as i want the same variable name from 2 different dataset).&lt;/P&gt;
&lt;PRE&gt;%macro EOex(inp=,testvar=);
data EO;
   set EOex.&amp;amp;inp.;
   EOTEST=upcase(cats(substr(&amp;amp;testvar,1,4),substr(&amp;amp;testvar,length(&amp;amp;testvar)-1)));
   EOCAT=upcase(scan(&amp;amp;testvar,1));
run;
%mend;
%EOex(inp=EO_incl,testvar=EOi_std);
%EOex(inp=EO_excl,testvar=EOe_std);
&lt;/PRE&gt;
&lt;P&gt;But if i use it then it will just give me the last call and not the set of 2 calls. How can i set them in the same program?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 12:03:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-the-dataset-with-the-new-macro-call/m-p/443719#M111033</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2018-03-08T12:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to update the dataset with the new macro call</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-update-the-dataset-with-the-new-macro-call/m-p/443725#M111034</link>
      <description>&lt;P&gt;As I have mentioned on many occasions, macro code does not do anything, it is a text find and replace system.&amp;nbsp; So what do we do with the code you presented, we do a find and replace, so that code becomes:&lt;/P&gt;
&lt;PRE&gt;data EO;
   set EOex.EO_incl;
   EOTEST=upcase(cats(substr(EOi_std,1,4),substr(EOi_std,length(EOi_std)-1)));
   EOCAT=upcase(scan(EOi_std,1));
run;
data EO;
   set EOex.EO_excl;
   EOTEST=upcase(cats(substr(EOe_std,1,4),substr(EOe_std,length(EOe_std)-1)));
   EOCAT=upcase(scan(EOe_std,1));
run;&lt;/PRE&gt;
&lt;P&gt;Now what part of this&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;actual executable code&lt;/STRONG&gt;&lt;/U&gt; does not work the way you had intended?&amp;nbsp; Is it because you are overwriting EO in both the first and second calls to the macro?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you would again find your like is much simpler using industry standards - possibly CDISC SDTM due to this being inclusion/exclusion information, this way you would have all the data in one dataset, and the same code could run over just one dataset.&amp;nbsp; Even if not using that, you can simplfy your code 50% by:&lt;/P&gt;
&lt;PRE&gt;data eo;
  set eoex.eo_incl (rename=(eoi_std=std))
        eoex.eo_excl (rename=(eoe_std=std));
  eotest=upcase(cats(substr(std,1,4),substr(std,length(std)-1)));
  eocat=upcase(scan(std,1));
run;&lt;/PRE&gt;
&lt;P&gt;See,&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;never a need&lt;/STRONG&gt;&lt;/U&gt; to use macro.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 12:26:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-update-the-dataset-with-the-new-macro-call/m-p/443725#M111034</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-03-08T12:26:54Z</dc:date>
    </item>
  </channel>
</rss>

