<?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: Make value of column to 0 if it is between 0 to -1, but only 3 time as shown below. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Make-value-of-column-to-0-if-it-is-between-0-to-1-but-only-3/m-p/330409#M74117</link>
    <description>&lt;P&gt;First off, why would you want to do this in proc sql? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Doing this in a data step is much simpler and much more understandable&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Feb 2017 08:58:12 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2017-02-07T08:58:12Z</dc:date>
    <item>
      <title>Make value of column to 0 if it is between 0 to -1, but only 3 time as shown below.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Make-value-of-column-to-0-if-it-is-between-0-to-1-but-only-3/m-p/330270#M74036</link>
      <description>&lt;P&gt;i have one column named sales, I want to create a new column sales , but new column value become 0 if it is between 0 to -1, but only 3 time as shown below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;sales&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;new_sales&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;300&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;300&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;-0.5&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;300&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;300&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;-0.001&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;0.2&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;0.2&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;-0.3&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;-0.4&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;-0.4&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;-0.0009&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;-0.0009&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;0.9&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;0.9&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;-0.007&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;-0.007&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 06 Feb 2017 19:12:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Make-value-of-column-to-0-if-it-is-between-0-to-1-but-only-3/m-p/330270#M74036</guid>
      <dc:creator>subrat1</dc:creator>
      <dc:date>2017-02-06T19:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Make value of column to 0 if it is between 0 to -1, but only 3 time as shown below.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Make-value-of-column-to-0-if-it-is-between-0-to-1-but-only-3/m-p/330287#M74043</link>
      <description>&lt;P&gt;like this? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   infile datalines;
   input sales;
   datalines;
300
-0.5
300
-0.001
0.2
-0.3
-0.4
-0.0009
0.9
-0.007
;

data want(drop = count);
   set have;
   
   newsales = sales;

   if -1 &amp;lt;= sales &amp;amp; sales &amp;lt;= 0 &amp;amp; count &amp;lt; 3 then do;
      newsales = 0;
      count + 1;
   end;

   retain count;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Feb 2017 19:48:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Make-value-of-column-to-0-if-it-is-between-0-to-1-but-only-3/m-p/330287#M74043</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-02-06T19:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Make value of column to 0 if it is between 0 to -1, but only 3 time as shown below.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Make-value-of-column-to-0-if-it-is-between-0-to-1-but-only-3/m-p/330407#M74116</link>
      <description>How to do the same using proc sql&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Feb 2017 08:51:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Make-value-of-column-to-0-if-it-is-between-0-to-1-but-only-3/m-p/330407#M74116</guid>
      <dc:creator>subrat1</dc:creator>
      <dc:date>2017-02-07T08:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Make value of column to 0 if it is between 0 to -1, but only 3 time as shown below.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Make-value-of-column-to-0-if-it-is-between-0-to-1-but-only-3/m-p/330409#M74117</link>
      <description>&lt;P&gt;First off, why would you want to do this in proc sql? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Doing this in a data step is much simpler and much more understandable&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2017 08:58:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Make-value-of-column-to-0-if-it-is-between-0-to-1-but-only-3/m-p/330409#M74117</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-02-07T08:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Make value of column to 0 if it is between 0 to -1, but only 3 time as shown below.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Make-value-of-column-to-0-if-it-is-between-0-to-1-but-only-3/m-p/330495#M74157</link>
      <description>&lt;P&gt;SQL does not have a natural "order" of operating on data. To force specific sequence processing can be extremely difficult and/or require much more code for sequential processing.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2017 15:34:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Make-value-of-column-to-0-if-it-is-between-0-to-1-but-only-3/m-p/330495#M74157</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-07T15:34:58Z</dc:date>
    </item>
  </channel>
</rss>

