<?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: too many conditional statements for large datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/too-many-conditional-statements-for-large-datasets/m-p/373162#M89273</link>
    <description>&lt;P&gt;I would really be suprised if the use of thousands of macro variables is the best method to process data. &amp;nbsp;Base SAS is the executable language for processing data, and is fully functional, macro does not do anything other than generate this code. &amp;nbsp;If you can provide some examples I can show better methods to get the output. &amp;nbsp;For example there is data modelling, i.e. restructuring data to make coding more efficient - one thing I always see is the "Excel" mentality, having data going across the page which is ok for people to look at, but sub optimal to program with. &amp;nbsp;Next there is lots of functionality within the base langauge to perform various functions against arrays of variables and over numbers of rows. &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jul 2017 08:02:25 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-07-05T08:02:25Z</dc:date>
    <item>
      <title>too many conditional statements for large datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/too-many-conditional-statements-for-large-datasets/m-p/373153#M89268</link>
      <description>&lt;P&gt;so i have coded thousands of macro variables each containing a if statement that i need to process in a data step.&lt;/P&gt;
&lt;P&gt;ideally, i can just make 1 macro and run it.&amp;nbsp; however, it's too big for 1 macro variable to handle.&lt;/P&gt;
&lt;P&gt;so i have no choice but to create thousands.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so how do i call each of the macro variable in 1 data step?&lt;/P&gt;
&lt;P&gt;right now, i am doing a loop which will call 1 macro at a time but it's just terrible inefficient.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;example,&lt;/P&gt;
&lt;P&gt;%do i=1 %to &amp;amp;count %by 1;&lt;/P&gt;
&lt;P&gt;data step;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set step;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;amp;macro&amp;amp;i;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;something like this.&lt;/P&gt;
&lt;P&gt;how can i make this into 1 data step and run all macro variables within?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks a bunch.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 05:53:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/too-many-conditional-statements-for-large-datasets/m-p/373153#M89268</guid>
      <dc:creator>Grumbler</dc:creator>
      <dc:date>2017-07-05T05:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: too many conditional statements for large datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/too-many-conditional-statements-for-large-datasets/m-p/373155#M89270</link>
      <description>&lt;P&gt;Can you change your design to use DOSUBL or %include code from a text file?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you post a small example of what you're process is so we can make better suggestion for improvement or alternatives?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49407"&gt;@Grumbler&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;so i have coded thousands of macro variables each containing a if statement that i need to process in a data step.&lt;/P&gt;
&lt;P&gt;ideally, i can just make 1 macro and run it.&amp;nbsp; however, it's too big for 1 macro variable to handle.&lt;/P&gt;
&lt;P&gt;so i have no choice but to create thousands.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so how do i call each of the macro variable in 1 data step?&lt;/P&gt;
&lt;P&gt;right now, i am doing a loop which will call 1 macro at a time but it's just terrible inefficient.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;example,&lt;/P&gt;
&lt;P&gt;%do i=1 %to &amp;amp;count %by 1;&lt;/P&gt;
&lt;P&gt;data step;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set step;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;amp;macro&amp;amp;i;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;something like this.&lt;/P&gt;
&lt;P&gt;how can i make this into 1 data step and run all macro variables within?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks a bunch.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 06:02:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/too-many-conditional-statements-for-large-datasets/m-p/373155#M89270</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-05T06:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: too many conditional statements for large datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/too-many-conditional-statements-for-large-datasets/m-p/373156#M89271</link>
      <description>&lt;P&gt;The ineffciency comes from reading the same data for each of your if statements. You should code it like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test;

  data step;
    set step;

    %do i=1 %to &amp;amp;count %by 1;
      &amp;amp;macro&amp;amp;i;
    %end;
  run;

%mend;

%test&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In this way the macro will generate all the IF statements in one DATA Step and the data is only red once.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 06:04:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/too-many-conditional-statements-for-large-datasets/m-p/373156#M89271</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2017-07-05T06:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: too many conditional statements for large datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/too-many-conditional-statements-for-large-datasets/m-p/373158#M89272</link>
      <description>thanks everyone.  problem solved.  forgot about using macro loops inside the data step.  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 05 Jul 2017 06:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/too-many-conditional-statements-for-large-datasets/m-p/373158#M89272</guid>
      <dc:creator>Grumbler</dc:creator>
      <dc:date>2017-07-05T06:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: too many conditional statements for large datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/too-many-conditional-statements-for-large-datasets/m-p/373162#M89273</link>
      <description>&lt;P&gt;I would really be suprised if the use of thousands of macro variables is the best method to process data. &amp;nbsp;Base SAS is the executable language for processing data, and is fully functional, macro does not do anything other than generate this code. &amp;nbsp;If you can provide some examples I can show better methods to get the output. &amp;nbsp;For example there is data modelling, i.e. restructuring data to make coding more efficient - one thing I always see is the "Excel" mentality, having data going across the page which is ok for people to look at, but sub optimal to program with. &amp;nbsp;Next there is lots of functionality within the base langauge to perform various functions against arrays of variables and over numbers of rows. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 08:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/too-many-conditional-statements-for-large-datasets/m-p/373162#M89273</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-05T08:02:25Z</dc:date>
    </item>
  </channel>
</rss>

