<?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: Creating new character variable based on two existing variables in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-character-variable-based-on-two-existing-variables/m-p/349443#M23053</link>
    <description>&lt;P&gt;It sounds like some simple logic would do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if ID1=ID2 then Final_id = ID1;&lt;/P&gt;
&lt;P&gt;else if ID1='xxxx' then Final_id = ID2;&lt;/P&gt;
&lt;P&gt;else if ID2 = 'xxxx' then Final_id = ID1;&lt;/P&gt;
&lt;P&gt;else do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Final_id = ID1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Second_id = ID2;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Optionally, if you really want to, you could add:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if Second_id = ' ' then Second_id = '-';&lt;/P&gt;</description>
    <pubDate>Wed, 12 Apr 2017 13:32:43 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-04-12T13:32:43Z</dc:date>
    <item>
      <title>Creating new character variable based on two existing variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-character-variable-based-on-two-existing-variables/m-p/349390#M23045</link>
      <description>&lt;P&gt;Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder could I get some help on the following. I have two existing character variables which are both ids. One is a product of method a while the other is a product of method b.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create a third variable which takes the accurate matches from both. A simple table illustrates my point.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also where we have a contrasting match this &amp;nbsp;output is placed in a second variable.&amp;nbsp;&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;ID1&lt;/TD&gt;&lt;TD&gt;ID2&lt;/TD&gt;&lt;TD&gt;Final id&lt;/TD&gt;&lt;TD&gt;Second Id&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xxxx&lt;/TD&gt;&lt;TD&gt;5b&lt;/TD&gt;&lt;TD&gt;5b&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6i&lt;/TD&gt;&lt;TD&gt;xxxx&lt;/TD&gt;&lt;TD&gt;6i&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8c&lt;/TD&gt;&lt;TD&gt;5j&lt;/TD&gt;&lt;TD&gt;8c&lt;/TD&gt;&lt;TD&gt;5j&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9g&lt;/TD&gt;&lt;TD&gt;xxxx&lt;/TD&gt;&lt;TD&gt;9g&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10b&lt;/TD&gt;&lt;TD&gt;10b&lt;/TD&gt;&lt;TD&gt;10b&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be great!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 11:55:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-character-variable-based-on-two-existing-variables/m-p/349390#M23045</guid>
      <dc:creator>Sean_OConnor</dc:creator>
      <dc:date>2017-04-12T11:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new character variable based on two existing variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-character-variable-based-on-two-existing-variables/m-p/349391#M23046</link>
      <description>&lt;P&gt;You have the 'xxx' in your dataset as indicated?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 11:58:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-character-variable-based-on-two-existing-variables/m-p/349391#M23046</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-12T11:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new character variable based on two existing variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-character-variable-based-on-two-existing-variables/m-p/349392#M23047</link>
      <description>&lt;P&gt;Hi Reeza,&lt;BR /&gt;&lt;BR /&gt;Yes all failed matches have a 'xxxx' inserted.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 11:59:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-character-variable-based-on-two-existing-variables/m-p/349392#M23047</guid>
      <dc:creator>Sean_OConnor</dc:creator>
      <dc:date>2017-04-12T11:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new character variable based on two existing variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-character-variable-based-on-two-existing-variables/m-p/349399#M23048</link>
      <description>&lt;P&gt;Look at the IFC function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or in Query builder, created a new column. You can use a CASE statement in your computed column.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 12:14:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-character-variable-based-on-two-existing-variables/m-p/349399#M23048</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-12T12:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new character variable based on two existing variables</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-character-variable-based-on-two-existing-variables/m-p/349443#M23053</link>
      <description>&lt;P&gt;It sounds like some simple logic would do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if ID1=ID2 then Final_id = ID1;&lt;/P&gt;
&lt;P&gt;else if ID1='xxxx' then Final_id = ID2;&lt;/P&gt;
&lt;P&gt;else if ID2 = 'xxxx' then Final_id = ID1;&lt;/P&gt;
&lt;P&gt;else do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Final_id = ID1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Second_id = ID2;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Optionally, if you really want to, you could add:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if Second_id = ' ' then Second_id = '-';&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 13:32:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-character-variable-based-on-two-existing-variables/m-p/349443#M23053</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-04-12T13:32:43Z</dc:date>
    </item>
  </channel>
</rss>

