<?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: Data Step - placing of statements such as keep in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-placing-of-statements-such-as-keep/m-p/748288#M235017</link>
    <description>&lt;P&gt;#1 and #3 are very close, as they determine what is&amp;nbsp;&lt;EM&gt;output&lt;/EM&gt;, without affecting the presence of variables within the step.&lt;/P&gt;
&lt;P&gt;#1 allows to be selective (if you have more than one dataset in the DATA statement, you can control the variables individually).&lt;/P&gt;
&lt;P&gt;#2 filters what &lt;EM&gt;goes into&lt;/EM&gt; the data step, so the other variables contained in the input dataset will not be present during the step.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Jun 2021 09:48:36 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-06-16T09:48:36Z</dc:date>
    <item>
      <title>Data Step - placing of statements such as keep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-placing-of-statements-such-as-keep/m-p/748286#M235015</link>
      <description>&lt;P&gt;In a data step, I have came across different places to put for instance your keep statement. Example , with Pseudo Code:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data MyTry(keep=ColA) ; *Alternative 1;
   set SomeData(keep = ColA);  *Alternative 2;
   keep ColA; *Alternative 3;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Putting the keep as in Alternative 2, often gives more efficient program due to reading in less data.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;But what is the difference between Alternative 1 and Alternative 3? Pros and cons with the alternatives?&amp;nbsp;&lt;BR /&gt;In my experience Alternative 1 is very rear (I have not seen it often).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 09:45:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Step-placing-of-statements-such-as-keep/m-p/748286#M235015</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-06-16T09:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: Data Step - placing of statements such as keep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-placing-of-statements-such-as-keep/m-p/748288#M235017</link>
      <description>&lt;P&gt;#1 and #3 are very close, as they determine what is&amp;nbsp;&lt;EM&gt;output&lt;/EM&gt;, without affecting the presence of variables within the step.&lt;/P&gt;
&lt;P&gt;#1 allows to be selective (if you have more than one dataset in the DATA statement, you can control the variables individually).&lt;/P&gt;
&lt;P&gt;#2 filters what &lt;EM&gt;goes into&lt;/EM&gt; the data step, so the other variables contained in the input dataset will not be present during the step.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 09:48:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Step-placing-of-statements-such-as-keep/m-p/748288#M235017</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-16T09:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: Data Step - placing of statements such as keep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-placing-of-statements-such-as-keep/m-p/748289#M235018</link>
      <description>&lt;P&gt;PS this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   keep ColA; *Alternative 3;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is a&amp;nbsp;&lt;EM&gt;statement&lt;/EM&gt;, the others are&amp;nbsp;&lt;EM&gt;dataset options&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 09:49:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Step-placing-of-statements-such-as-keep/m-p/748289#M235018</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-16T09:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Data Step - placing of statements such as keep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-placing-of-statements-such-as-keep/m-p/748337#M235043</link>
      <description>&lt;P&gt;For practical purposes, you know all you really need to know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Complications arise if you use both tools.&amp;nbsp; For example, would these two programs get the same results or different results?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (drop=name);
   set have;
   keep name;
run;

data want (keep=name);
   set have;
   drop name;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The complications get compounded if you use RENAME in one spot, but KEEP or DROP in the other spot.&amp;nbsp; Should KEEP (or DROP) refer to the original name or to the new name?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are rules about that, but rather than memorize them just avoid the situation.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 13:27:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Step-placing-of-statements-such-as-keep/m-p/748337#M235043</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-06-16T13:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Data Step - placing of statements such as keep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-placing-of-statements-such-as-keep/m-p/748345#M235046</link>
      <description>&lt;P&gt;The one rule I remember is that dataset options are processed in alphabetical order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DROP/KEEP&lt;/P&gt;
&lt;P&gt;RENAME&lt;/P&gt;
&lt;P&gt;WHERE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 14:06:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Step-placing-of-statements-such-as-keep/m-p/748345#M235046</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-16T14:06:32Z</dc:date>
    </item>
  </channel>
</rss>

