<?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: Computed column in SAS EG query builder to merge null field from two columns into one in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Computed-column-in-SAS-EG-query-builder-to-merge-null-field-from/m-p/765072#M39448</link>
    <description>&lt;P&gt;Don't know how query builder might use the COALESCEC function but that appears to be what you want. Look for how to build an expression.&lt;/P&gt;
&lt;P&gt;The generated code would look something like:&lt;/P&gt;
&lt;PRE&gt;Proc sql;
   create table new as
   select itemnumber, coalescec(company,parentcompany) as newcolumn
   from have;
run;&lt;/PRE&gt;
&lt;P&gt;The Coalescec function for character values, and Coalesce for numeric, returns the first value encountered in the list of values provided in the function call in order from left to right. So when Company is populated that is the result, when missing then Parentcompany is the result. If both are missing the result will be missing.&lt;/P&gt;</description>
    <pubDate>Tue, 31 Aug 2021 14:52:10 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-08-31T14:52:10Z</dc:date>
    <item>
      <title>Computed column in SAS EG query builder to merge null field from two columns into one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Computed-column-in-SAS-EG-query-builder-to-merge-null-field-from/m-p/765036#M39447</link>
      <description>&lt;P&gt;Can I do a computed column in SAS EG query builder to create a new column that merges two different columns into one. Below is an example of what I’m talking about:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Item Number&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Company&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;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D&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;5678&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;123 Inc&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;9123&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;XYZ Inc&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;8765&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;QRT LLC&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 12:26:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Computed-column-in-SAS-EG-query-builder-to-merge-null-field-from/m-p/765036#M39447</guid>
      <dc:creator>WorkUser</dc:creator>
      <dc:date>2021-08-31T12:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Computed column in SAS EG query builder to merge null field from two columns into one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Computed-column-in-SAS-EG-query-builder-to-merge-null-field-from/m-p/765072#M39448</link>
      <description>&lt;P&gt;Don't know how query builder might use the COALESCEC function but that appears to be what you want. Look for how to build an expression.&lt;/P&gt;
&lt;P&gt;The generated code would look something like:&lt;/P&gt;
&lt;PRE&gt;Proc sql;
   create table new as
   select itemnumber, coalescec(company,parentcompany) as newcolumn
   from have;
run;&lt;/PRE&gt;
&lt;P&gt;The Coalescec function for character values, and Coalesce for numeric, returns the first value encountered in the list of values provided in the function call in order from left to right. So when Company is populated that is the result, when missing then Parentcompany is the result. If both are missing the result will be missing.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 14:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Computed-column-in-SAS-EG-query-builder-to-merge-null-field-from/m-p/765072#M39448</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-31T14:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Computed column in SAS EG query builder to merge null field from two columns into one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Computed-column-in-SAS-EG-query-builder-to-merge-null-field-from/m-p/765324#M39477</link>
      <description>&lt;P&gt;Thanks but I think I figured it out with a case statement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;case&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;when not missing(parentcompany) then parentcompany&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else company&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;end&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 12:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Computed-column-in-SAS-EG-query-builder-to-merge-null-field-from/m-p/765324#M39477</guid>
      <dc:creator>WorkUser</dc:creator>
      <dc:date>2021-09-01T12:31:38Z</dc:date>
    </item>
  </channel>
</rss>

