<?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: Best way to fill missing text column value with numeric value in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357401#M23520</link>
    <description>&lt;P&gt;Please clarify what you are doing. &amp;nbsp;Follow the guidance under post a question - post test data in the form of a datastep, and what you want the output to look like. &amp;nbsp;Also (important in this case), post your full code for that block, use the code window {i} above post.&lt;/P&gt;
&lt;P&gt;From what you have posted we cannot see if you are using datastep or SQL. &amp;nbsp;At a guess:&lt;/P&gt;
&lt;P&gt;Datastep:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  text_field=ifc(text_field=' ',put(numeric_field,z9.),text_field);
/* or */
  text_field=coalescec(text_field,put(numeric_field,z9.));
run;&lt;/PRE&gt;
&lt;P&gt;SQL:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select COALESCE(TEXT_FIELD,put(NUMERIC_FIELD,z9.)) as NEW_FIELD
  from   HAVE;
quit;&lt;/PRE&gt;</description>
    <pubDate>Wed, 10 May 2017 09:02:39 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-05-10T09:02:39Z</dc:date>
    <item>
      <title>Best way to fill missing text column value with numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357342#M23514</link>
      <description>&lt;P&gt;Hi I need help in how to fill a text missing field value with a value from a numeric field? &amp;nbsp;I tried using case statement but that is not working. &amp;nbsp;Below is my case statement. &amp;nbsp;This is not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;case&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when text_field = ' '&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; then put (numeric_field,z9.)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else text_field&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; End as new_field&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I was adviced to use the coalesce function and that is not working. &amp;nbsp;I have tried proc sql and data step not working. &amp;nbsp;My understanding is that when using coalesce function field types have to be the same. &amp;nbsp;Any help will be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 00:09:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357342#M23514</guid>
      <dc:creator>FrancesU</dc:creator>
      <dc:date>2017-05-10T00:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to fill missing text column value with numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357348#M23515</link>
      <description>&lt;P&gt;As per the code, it seems fine. Could you please provide the log and sample data for better response.&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 00:57:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357348#M23515</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-05-10T00:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to fill missing text column value with numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357352#M23516</link>
      <description>&lt;P&gt;That's obviously not your actual code, so perhaps post your actual code and log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ideally, a sample where the issue is replicated is helpful, especially in a case such as yours, where the code appears correct.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For using COALESCE it would be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;COALESCEC(text_field, put(numeric_field, z9.)) as new_field&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My guess is going to be that your 'missing' value isn't missing. Use a hex format to view the field or COMPRESS anything that may look like a blank but actually has a tab or some other value.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 01:11:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357352#M23516</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-10T01:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to fill missing text column value with numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357355#M23517</link>
      <description>&lt;P&gt;If I'm not mistaken (?), the word THEN does not belong in a CASE statement. &amp;nbsp;Just remove it (assuming you have built the rest of the SQL code properly).&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 01:47:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357355#M23517</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-05-10T01:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to fill missing text column value with numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357356#M23518</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt; but the word THEN is part of the case when syntax in proc sql. Please correct me</description>
      <pubDate>Wed, 10 May 2017 01:53:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357356#M23518</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-05-10T01:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to fill missing text column value with numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357359#M23519</link>
      <description>&lt;P&gt;Just going by memory ... I will have to test it tomorrow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;Looks like memory was faulty here ... THEN is definitely part of a CASE statement.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 12:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357359#M23519</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-05-10T12:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to fill missing text column value with numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357401#M23520</link>
      <description>&lt;P&gt;Please clarify what you are doing. &amp;nbsp;Follow the guidance under post a question - post test data in the form of a datastep, and what you want the output to look like. &amp;nbsp;Also (important in this case), post your full code for that block, use the code window {i} above post.&lt;/P&gt;
&lt;P&gt;From what you have posted we cannot see if you are using datastep or SQL. &amp;nbsp;At a guess:&lt;/P&gt;
&lt;P&gt;Datastep:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  text_field=ifc(text_field=' ',put(numeric_field,z9.),text_field);
/* or */
  text_field=coalescec(text_field,put(numeric_field,z9.));
run;&lt;/PRE&gt;
&lt;P&gt;SQL:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select COALESCE(TEXT_FIELD,put(NUMERIC_FIELD,z9.)) as NEW_FIELD
  from   HAVE;
quit;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 May 2017 09:02:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Best-way-to-fill-missing-text-column-value-with-numeric-value/m-p/357401#M23520</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-10T09:02:39Z</dc:date>
    </item>
  </channel>
</rss>

