<?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: Loop inside Macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Loop-inside-Macro/m-p/337130#M76517</link>
    <description>&lt;P&gt;I wouldn't use a macro for it but, since you already wrote it, just make a copy of your original file and then change your macro to work on that file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/* first run a data step like*/

data mydata.fhsim_n;
  set mydata.fhsim;
run;

/*then change your macro to*/
%macro numeric(var);
  data mydata.fhsim_n;
    set mydata.fhsim_n;
    &amp;amp;var._n=input(&amp;amp;var ,8.);
  run;
%mend numeric;

%numeric(Account_No); run;
%numeric(Acct_Status); run;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
    <pubDate>Wed, 01 Mar 2017 20:09:25 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-03-01T20:09:25Z</dc:date>
    <item>
      <title>Loop inside Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-inside-Macro/m-p/337122#M76513</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;I am trying to change the format from character to numeric of a list of variables in my dataset. I've written the code but it seems that it applies only to the last variable. So I cannot see all new numeric variables in my dataset. Can anyone help me? The code is attached.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro numeric(var);&lt;BR /&gt;data mydata.fhsim_n;&lt;BR /&gt;set mydata.fhsim;&lt;BR /&gt;&amp;amp;var._n=input(&amp;amp;var ,8.);&lt;BR /&gt;run;&lt;BR /&gt;%mend numeric;&lt;BR /&gt;%numeric(Account_No); run;&lt;BR /&gt;%numeric(Acct_Status); run;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 19:57:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-inside-Macro/m-p/337122#M76513</guid>
      <dc:creator>yelena</dc:creator>
      <dc:date>2017-03-01T19:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-inside-Macro/m-p/337126#M76514</link>
      <description>&lt;P&gt;You're rewriting the new file each time you run the macro.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 20:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-inside-Macro/m-p/337126#M76514</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-01T20:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-inside-Macro/m-p/337128#M76516</link>
      <description>What should I then do to keep all variables in?&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Mar 2017 20:04:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-inside-Macro/m-p/337128#M76516</guid>
      <dc:creator>yelena</dc:creator>
      <dc:date>2017-03-01T20:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-inside-Macro/m-p/337130#M76517</link>
      <description>&lt;P&gt;I wouldn't use a macro for it but, since you already wrote it, just make a copy of your original file and then change your macro to work on that file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/* first run a data step like*/

data mydata.fhsim_n;
  set mydata.fhsim;
run;

/*then change your macro to*/
%macro numeric(var);
  data mydata.fhsim_n;
    set mydata.fhsim_n;
    &amp;amp;var._n=input(&amp;amp;var ,8.);
  run;
%mend numeric;

%numeric(Account_No); run;
%numeric(Acct_Status); run;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 20:09:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-inside-Macro/m-p/337130#M76517</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-01T20:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-inside-Macro/m-p/337131#M76518</link>
      <description>Thank you very much! Let me try!&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Mar 2017 20:13:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-inside-Macro/m-p/337131#M76518</guid>
      <dc:creator>yelena</dc:creator>
      <dc:date>2017-03-01T20:13:19Z</dc:date>
    </item>
  </channel>
</rss>

