<?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: Replacing blank value to 0 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686583#M208379</link>
    <description>&lt;P&gt;You cannot create a table with a column whose name is repeated.&lt;/P&gt;
&lt;P&gt;This is indicated by the log message&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;WARNING: Variable bounceflag already exists on file WORK.WITHBOUNCE_NEW.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So either 1) create a new column, or 2) don't use &lt;FONT face="courier new,courier"&gt;select *&lt;/FONT&gt;&amp;nbsp;when you clean the values: list the columns and do the cleaning where needed&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Sep 2020 00:17:41 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2020-09-25T00:17:41Z</dc:date>
    <item>
      <title>Replacing blank value to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686550#M208352</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to replace all the blank values of Bounceflag to 0, here's what I wrote:&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table withbounce_new as&lt;BR /&gt;select withbounce.*,&lt;BR /&gt;case when bounceflag='' then bounceflag='0' end&lt;BR /&gt;from withbounce;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However SAS is showing me this (see screenshot), it created a new variable for me but I actually only wanted to replace all the blank values of Bounceflag to 0. Thanks in advance!&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 450px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49764i5C42758639815096/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 21:57:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686550#M208352</guid>
      <dc:creator>yichentian226</dc:creator>
      <dc:date>2020-09-24T21:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank value to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686552#M208353</link>
      <description>You didn't give the new variable a name. Once you've done a calculation you need to assign it to the new variable name.&lt;BR /&gt;&lt;BR /&gt;case when ...end as bounceflag&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Sep 2020 22:03:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686552#M208353</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-09-24T22:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank value to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686554#M208354</link>
      <description>&lt;P&gt;Thanks! However as I wrote&amp;nbsp;case when bounceflag='' then bounceflag='0' end as bounceflag, I got this, blank space still blank...&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 479px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49765iBBAD3092A492EF1E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 22:08:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686554#M208354</guid>
      <dc:creator>yichentian226</dc:creator>
      <dc:date>2020-09-24T22:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank value to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686555#M208355</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when missing(bounceflag) then '0' end as bounceflag&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Sep 2020 22:10:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686555#M208355</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-24T22:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank value to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686557#M208357</link>
      <description>&lt;P&gt;Hey thanks for helping again, appreciated! But I tried your code still it's blank space Im not sure..&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 22:12:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686557#M208357</guid>
      <dc:creator>yichentian226</dc:creator>
      <dc:date>2020-09-24T22:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank value to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686561#M208361</link>
      <description>&lt;P&gt;Show us the LOG (the entire log for the PROC SQL step, including the code as it appears in the log, plus any NOTEs, WARNINGs or ERRORs for this step), with nothing chopped out.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 22:25:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686561#M208361</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-24T22:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank value to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686563#M208362</link>
      <description>&lt;P&gt;&lt;BR /&gt;1 %_eg_hidenotesandsource;&lt;BR /&gt;5 %_eg_hidenotesandsource;&lt;BR /&gt;29&lt;BR /&gt;30&lt;BR /&gt;31 proc sql;&lt;BR /&gt;32 create table withbounce_new as&lt;BR /&gt;33 select withbounce.*,&lt;BR /&gt;34 case when missing(bounceflag) then 0 end as bounceflag&lt;BR /&gt;35 from withbounce;&lt;BR /&gt;NOTE: A CASE expression has no ELSE clause. Cases not accounted for by the WHEN clauses will result in a missing value for the CASE&lt;BR /&gt;expression.&lt;BR /&gt;WARNING: Variable bounceflag already exists on file WORK.WITHBOUNCE_NEW.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I guess I need to create a new variable and drop the original bounceflag?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 22:31:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686563#M208362</guid>
      <dc:creator>yichentian226</dc:creator>
      <dc:date>2020-09-24T22:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank value to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686564#M208363</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/318223"&gt;@yichentian226&lt;/a&gt;&amp;nbsp; try-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when missing(bounceflag) then '0'  else bounceflag end as bounceflag&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;example-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
 do bounceflag='test',' ','test';
  output;
 end;
run;
proc sql;
 create table want as 
 select case when missing(bounceflag) then '0'  else bounceflag end as bounceflag
 from have;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Sep 2020 22:35:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686564#M208363</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-09-24T22:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank value to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686565#M208364</link>
      <description>&lt;P&gt;proc sql;&lt;BR /&gt;create table withbounce_new as&lt;BR /&gt;select withbounce.*,&lt;BR /&gt;case when missing(bounceflag) then '0' else '1' end as bounceflag_&lt;BR /&gt;from withbounce;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i did this and it worked thanks!!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 22:34:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686565#M208364</guid>
      <dc:creator>yichentian226</dc:creator>
      <dc:date>2020-09-24T22:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank value to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686567#M208366</link>
      <description>&lt;P&gt;The COALESCEC function it the easiest way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data withbounce;
  retain bounceflag '';
  do i = 1 to 10;
    output;
  end;
run;

proc sql;
create table withbounce_new as
select withbounce.*,coalescec(bounceflag,'0') as bounceflag_
from withbounce;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Sep 2020 22:45:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686567#M208366</guid>
      <dc:creator>CurtisMackWSIPP</dc:creator>
      <dc:date>2020-09-24T22:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing blank value to 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686583#M208379</link>
      <description>&lt;P&gt;You cannot create a table with a column whose name is repeated.&lt;/P&gt;
&lt;P&gt;This is indicated by the log message&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;WARNING: Variable bounceflag already exists on file WORK.WITHBOUNCE_NEW.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So either 1) create a new column, or 2) don't use &lt;FONT face="courier new,courier"&gt;select *&lt;/FONT&gt;&amp;nbsp;when you clean the values: list the columns and do the cleaning where needed&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2020 00:17:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-blank-value-to-0/m-p/686583#M208379</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-09-25T00:17:41Z</dc:date>
    </item>
  </channel>
</rss>

