<?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 coalesce in datastep in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/coalesce-in-datastep/m-p/322139#M71251</link>
    <description>&lt;P&gt;This is some simplified code I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA WORK.Temp;
INPUT A B;
   DATALINES;
1 .
. 1
. .
1 2
;

Data WORK.TempOut;
	Set WORK.Temp;
	Test = coalescec(B, A);
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WORK.TempOut looks as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;A	B	Test
1	.	           .
.	1	           1
.	.	           .
1	2	           2&lt;/PRE&gt;&lt;P&gt;I would expect Test in row 1 to contain 1 but it does not. Why is this? Why is the null entry in column B of row 1 not replaced by 1?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jan 2017 14:48:22 GMT</pubDate>
    <dc:creator>csetzkorn</dc:creator>
    <dc:date>2017-01-03T14:48:22Z</dc:date>
    <item>
      <title>coalesce in datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coalesce-in-datastep/m-p/322139#M71251</link>
      <description>&lt;P&gt;This is some simplified code I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA WORK.Temp;
INPUT A B;
   DATALINES;
1 .
. 1
. .
1 2
;

Data WORK.TempOut;
	Set WORK.Temp;
	Test = coalescec(B, A);
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WORK.TempOut looks as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;A	B	Test
1	.	           .
.	1	           1
.	.	           .
1	2	           2&lt;/PRE&gt;&lt;P&gt;I would expect Test in row 1 to contain 1 but it does not. Why is this? Why is the null entry in column B of row 1 not replaced by 1?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 14:48:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coalesce-in-datastep/m-p/322139#M71251</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2017-01-03T14:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: coalesce in datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coalesce-in-datastep/m-p/322147#M71255</link>
      <description>&lt;P&gt;Hi: It looks like A and B are numeric variables. You are NOT using COALESCE you are using the form of the function for Character variables: COALESCE&lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;C&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;.&lt;BR /&gt;&lt;BR /&gt; I would expect you to be getting a note in the log, something like this: &lt;BR /&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;BR /&gt;&lt;BR /&gt; Have you tried the COALESCE function for numeric variables instead of COALESCEC?&lt;BR /&gt;&lt;BR /&gt;cynthia&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 14:59:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coalesce-in-datastep/m-p/322147#M71255</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-01-03T14:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: coalesce in datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coalesce-in-datastep/m-p/322148#M71256</link>
      <description>&lt;P&gt;That makes sense. Thanks it works!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 15:00:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coalesce-in-datastep/m-p/322148#M71256</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2017-01-03T15:00:03Z</dc:date>
    </item>
  </channel>
</rss>

