<?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: How to use the information from 2 variables and create a new one with it? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-information-from-2-variables-and-create-a-new-one/m-p/438966#M109491</link>
    <description>&lt;P&gt;Thank you!!!!!!&lt;/P&gt;</description>
    <pubDate>Wed, 21 Feb 2018 15:42:04 GMT</pubDate>
    <dc:creator>marysmith</dc:creator>
    <dc:date>2018-02-21T15:42:04Z</dc:date>
    <item>
      <title>How to use the information from 2 variables and create a new one with it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-information-from-2-variables-and-create-a-new-one/m-p/438949#M109482</link>
      <description>&lt;P&gt;Dear SAS Community.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need your help with this. I have 2 Character Variables "Auftraggeber" and "Manufacturer" and want to create a new Variable "Sponsor" with the information from those variables. The information from the variable "Auftraggeber" is the information I need, but there are a lot of missings in this variable. So if there is a missing in the variable "Auftraggeber" , I want SAS to take the Information from the variable "Manufacturer" then. How can I do this?&lt;/P&gt;&lt;P&gt;Thank you for your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried something like&lt;/P&gt;&lt;P&gt;data work.sponsors;&lt;BR /&gt;&amp;nbsp;set work.sponsors;&lt;BR /&gt;&amp;nbsp;sponsor = Auftraggeber;&lt;BR /&gt;&amp;nbsp;if Auftraggeber ne . then sponsor = Auftraggeber;&lt;BR /&gt;&amp;nbsp;if Auftraggeber = . then sponsor = Manufacturer;&lt;BR /&gt;&amp;nbsp;run;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 15:18:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-information-from-2-variables-and-create-a-new-one/m-p/438949#M109482</guid>
      <dc:creator>marysmith</dc:creator>
      <dc:date>2018-02-21T15:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the information from 2 variables and create a new one with it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-information-from-2-variables-and-create-a-new-one/m-p/438954#M109484</link>
      <description>&lt;P&gt;You've very nearly solved this one already! The main issue here is that you're comparing&amp;nbsp;a character variable to the numeric missing value. What you really want is&amp;nbsp;a comparison&amp;nbsp;using " " as your missing value. Here's a small re-write you can use, and since you've already set sponsor to Auftraggeber upfront, the only time you need to worry about Manufacturer is if that value was missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.sponsors;
     set work.sponsors;
     sponsor = Auftraggeber;
     if Auftraggeber eq " " then sponsor = Manufacturer;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 15:26:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-information-from-2-variables-and-create-a-new-one/m-p/438954#M109484</guid>
      <dc:creator>GinaRepole</dc:creator>
      <dc:date>2018-02-21T15:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the information from 2 variables and create a new one with it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-information-from-2-variables-and-create-a-new-one/m-p/438955#M109485</link>
      <description>&lt;P&gt;Depending on the type of the variable you need to check . or " " (single, quoted blank). I recommend using the function missing(variable) to find missing values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.sponsors;
   set work.sponsors;
   
   if missing(Auftraggeber) then do;
      sponsor = Auftraggeber;
   end;
   else do;
      sponsor = Manufacturer;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You do have interesting variable names, if you don't want to translate var names, check out the &lt;A href="https://communities.sas.com/t5/Regional-Groups/ct-p/regional" target="_blank"&gt;regional groups.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 15:27:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-information-from-2-variables-and-create-a-new-one/m-p/438955#M109485</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-02-21T15:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the information from 2 variables and create a new one with it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-information-from-2-variables-and-create-a-new-one/m-p/438958#M109487</link>
      <description>Thank you!!!!</description>
      <pubDate>Wed, 21 Feb 2018 15:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-information-from-2-variables-and-create-a-new-one/m-p/438958#M109487</guid>
      <dc:creator>marysmith</dc:creator>
      <dc:date>2018-02-21T15:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the information from 2 variables and create a new one with it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-information-from-2-variables-and-create-a-new-one/m-p/438966#M109491</link>
      <description>&lt;P&gt;Thank you!!!!!!&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 15:42:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-information-from-2-variables-and-create-a-new-one/m-p/438966#M109491</guid>
      <dc:creator>marysmith</dc:creator>
      <dc:date>2018-02-21T15:42:04Z</dc:date>
    </item>
  </channel>
</rss>

