<?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: keep in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/keep/m-p/818038#M322885</link>
    <description>&lt;P&gt;KEEP is a&amp;nbsp;&lt;EM&gt;declarative&lt;/EM&gt; statement; it is evaluated by the data step compiler when the data step is built from your code, so it cannot be executed conditionally (it is in fact never executed).&lt;/P&gt;
&lt;P&gt;OUTPUT, OTOH, is an&amp;nbsp;&lt;EM&gt;executable&lt;/EM&gt; statement which can be used conditionally (as is the fact in your code). It writes an observation to the output dataset.&lt;/P&gt;
&lt;P&gt;If no OUTPUT is coded by you, the data step compiler will insert one on its own at the very end of the data step, so for every completed data step iteration an observation is written.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jun 2022 10:11:16 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-06-14T10:11:16Z</dc:date>
    <item>
      <title>keep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep/m-p/818012#M322878</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if product_code in ('CC', 'IL', 'RL', 'VI') and sme=0 &lt;BR /&gt;and region ne 'MAC' &lt;BR /&gt;and org_code notin ('801', '802', '751') &lt;BR /&gt;and ((block_code_1 not in ('A', 'B', 'D', 'W', 'O', 'J', 'Q', 'I') &lt;BR /&gt;and block_code_2 not in ('A', 'B', 'D', 'W','O','J','Q','I')) &lt;BR /&gt;or ((block_code_1 in ('A','B','D','W','O','J','Q','I') &lt;BR /&gt;or block_code_2 in ('A','B','D','W','O','J','Q','I')) &lt;BR /&gt;and current_bal &amp;gt;0 and (block_code_1 ne 'A' &lt;BR /&gt;and block_code_2 ne 'A'))) then &lt;BR /&gt;output;
keep 
account_no
region
product_code
currency
cyrrent_delq
ind_default
block_code_1
date_block_code_1
block_code_2
date_block_code_1
current_bal
org_code
logo
customer_no
account_level_rating;
run;&lt;/PRE&gt;
&lt;P&gt;Hi I have the above command, what I am not sure is whether the command of keeping certain columns only happen when the if statement is fulfilled? also what does 'output' means here? only keeping the mentioned columns?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 07:48:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep/m-p/818012#M322878</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-06-14T07:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: keep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep/m-p/818016#M322880</link>
      <description>&lt;P&gt;Yes, the KEEP statement comes in effect when writing to the output table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OUTPUT will tell the data step to output the data with current values set. You can have multiple OUTPUT statements in a data step.&lt;/P&gt;
&lt;P&gt;If omitted, an implicit OUTPUT statment is "enforced" (at the end of the data step).&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 08:03:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep/m-p/818016#M322880</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2022-06-14T08:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: keep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep/m-p/818038#M322885</link>
      <description>&lt;P&gt;KEEP is a&amp;nbsp;&lt;EM&gt;declarative&lt;/EM&gt; statement; it is evaluated by the data step compiler when the data step is built from your code, so it cannot be executed conditionally (it is in fact never executed).&lt;/P&gt;
&lt;P&gt;OUTPUT, OTOH, is an&amp;nbsp;&lt;EM&gt;executable&lt;/EM&gt; statement which can be used conditionally (as is the fact in your code). It writes an observation to the output dataset.&lt;/P&gt;
&lt;P&gt;If no OUTPUT is coded by you, the data step compiler will insert one on its own at the very end of the data step, so for every completed data step iteration an observation is written.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 10:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep/m-p/818038#M322885</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-06-14T10:11:16Z</dc:date>
    </item>
  </channel>
</rss>

