<?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: Merging Variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Merging-Variables/m-p/496596#M72429</link>
    <description>&lt;P&gt;Thank You again Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I'm sorry, I promise, I'm trying to learn how to ask questions better.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Sep 2018 15:21:12 GMT</pubDate>
    <dc:creator>DanielQuay</dc:creator>
    <dc:date>2018-09-18T15:21:12Z</dc:date>
    <item>
      <title>Merging Variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merging-Variables/m-p/496575#M72426</link>
      <description>&lt;P&gt;Well, I'm afraid I'm back with another easy question, but I am stuck.&amp;nbsp; Or rather, I haven't gotten this to work in a way that I am happy.&lt;/P&gt;&lt;P&gt;I have three datasets that have been successfully combined, no problems there. The problem is when I am looking at the data, a number of variables were changed over the years the data was gathered.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The question is, "how many of the last 12 months were you employed".&lt;/P&gt;&lt;P&gt;In 2007, this variable was titled Months (which was later used for something completely different, at least I figured out how to separate that mess).&amp;nbsp; Then in 2008 it was changed to PastPay, and then in 2010 it was changed again to EMP_PAY. The data is pretty straightforward, respondents answered 1-12.&amp;nbsp; So it would look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2007&lt;/P&gt;&lt;P&gt;Obs1&amp;nbsp;= 1&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs2 = 3&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs3 = 9&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs3 = 5&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs4 = 11&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2008&lt;/P&gt;&lt;P&gt;Obs1&amp;nbsp;=&amp;nbsp;2&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs2 = 3&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs3 =&amp;nbsp;8&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs3 =&amp;nbsp;12&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs4 = 7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2010&lt;/P&gt;&lt;P&gt;Obs1&amp;nbsp;=&amp;nbsp;9&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs2 =&amp;nbsp;2&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs3 =&amp;nbsp;4&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs3 =&amp;nbsp;1&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs4 = 8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried do loops with if/then statements, tried catx, and tried an array but I haven't been able to get them combined.&amp;nbsp; (largely because I'm still learning SAS).&amp;nbsp; Sorry, I'm sure I'll have 8 simple answers and feel really dumb here in about 10 minutes but I'm hitting a wall right now.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 14:45:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merging-Variables/m-p/496575#M72426</guid>
      <dc:creator>DanielQuay</dc:creator>
      <dc:date>2018-09-18T14:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merging-Variables/m-p/496583#M72427</link>
      <description>&lt;P&gt;COALESCE().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assumptions:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;the variable is numeric&lt;/LI&gt;
&lt;LI&gt;you want them combined into a single variable (never actually stated what you wanted as output).&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;employed_prev12 = coalesce(Months, PastPay, Emp_Pay);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/205036"&gt;@DanielQuay&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Well, I'm afraid I'm back with another easy question, but I am stuck.&amp;nbsp; Or rather, I haven't gotten this to work in a way that I am happy.&lt;/P&gt;
&lt;P&gt;I have three datasets that have been successfully combined, no problems there. The problem is when I am looking at the data, a number of variables were changed over the years the data was gathered.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The question is, "how many of the last 12 months were you employed".&lt;/P&gt;
&lt;P&gt;In 2007, this variable was titled Months (which was later used for something completely different, at least I figured out how to separate that mess).&amp;nbsp; Then in 2008 it was changed to PastPay, and then in 2010 it was changed again to EMP_PAY. The data is pretty straightforward, respondents answered 1-12.&amp;nbsp; So it would look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2007&lt;/P&gt;
&lt;P&gt;Obs1&amp;nbsp;= 1&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs2 = 3&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs3 = 9&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs3 = 5&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs4 = 11&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2008&lt;/P&gt;
&lt;P&gt;Obs1&amp;nbsp;=&amp;nbsp;2&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs2 = 3&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs3 =&amp;nbsp;8&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs3 =&amp;nbsp;12&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs4 = 7&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2010&lt;/P&gt;
&lt;P&gt;Obs1&amp;nbsp;=&amp;nbsp;9&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs2 =&amp;nbsp;2&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs3 =&amp;nbsp;4&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs3 =&amp;nbsp;1&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs4 = 8&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried do loops with if/then statements, tried catx, and tried an array but I haven't been able to get them combined.&amp;nbsp; (largely because I'm still learning SAS).&amp;nbsp; Sorry, I'm sure I'll have 8 simple answers and feel really dumb here in about 10 minutes but I'm hitting a wall right now.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 15:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merging-Variables/m-p/496583#M72427</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-18T15:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merging-Variables/m-p/496596#M72429</link>
      <description>&lt;P&gt;Thank You again Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I'm sorry, I promise, I'm trying to learn how to ask questions better.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 15:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merging-Variables/m-p/496596#M72429</guid>
      <dc:creator>DanielQuay</dc:creator>
      <dc:date>2018-09-18T15:21:12Z</dc:date>
    </item>
  </channel>
</rss>

