<?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 get the third table based on the two? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-get-the-third-table-based-on-the-two/m-p/303032#M60776</link>
    <description>&lt;P&gt;OK, let's ignore REV and EXP since you will be hard-coding them.&amp;nbsp; Sort the data sets first, if they are not already sorted:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=year2015;&lt;/P&gt;
&lt;P&gt;by year;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;proc sort data=year2016;&lt;/P&gt;
&lt;P&gt;by year;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then combine them:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set year2016 (in=from2016) year2015 (in=from2015);&lt;/P&gt;
&lt;P&gt;by year;&lt;/P&gt;
&lt;P&gt;if from2016 then mid='d_2016';&lt;/P&gt;
&lt;P&gt;else mid='d_2015';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Oct 2016 20:43:30 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-10-06T20:43:30Z</dc:date>
    <item>
      <title>how to get the third table based on the two?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-get-the-third-table-based-on-the-two/m-p/303020#M60772</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables year2015, year2016, but how can I get the third table &lt;SPAN&gt;ds1&amp;nbsp;&lt;/SPAN&gt;based on the two by coding sas? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data year2015;&lt;BR /&gt;input year $ resp ;&lt;BR /&gt;datalines;&lt;BR /&gt;null 0.35&lt;BR /&gt;s_300 0.55&lt;BR /&gt;s_640 0.65&lt;BR /&gt;s_670 0.75&lt;BR /&gt;s_700 0.47&lt;BR /&gt;s_730 0.58&lt;BR /&gt;s_760 0.69&lt;BR /&gt;;run;&lt;BR /&gt;data year2016;&lt;BR /&gt;input year $ resp ;&lt;BR /&gt;datalines;&lt;BR /&gt;null 0.45&lt;BR /&gt;s_300 0.65&lt;BR /&gt;s_640 0.42&lt;BR /&gt;s_670 0.35&lt;BR /&gt;s_700 0.83&lt;BR /&gt;s_730 0.48&lt;BR /&gt;s_760 0.69&lt;BR /&gt;;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data ds1; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;input year $ mid $ resp exp rev; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;datalines; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;null d_2016 0.45 0.45 0.35&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;null d_2015 0.35 0.45 0.35&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_300 d_2016 0.65 0.65 0.55&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_300 d_2015 0.55 0.65 0.55&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_640 d_2016 0.42 0.42 0.65&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_640 d_2015 0.65 0.42 0.65&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_670 d_2016 0.35 0.35 0.75&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_670 d_2015 0.75 0.35 0.75&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_700 d_2016 0.83 0.83 0.47&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_700 d_2015 0.47 0.83 0.47&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_730 d_2016 0.48 0.48 0.58&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_730 d_2015 0.58 0.48 0.58&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_760 d_2016 0.67 0.67 0.69&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;s_760 d_2015 0.69 0.67 0.69&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 20:21:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-get-the-third-table-based-on-the-two/m-p/303020#M60772</guid>
      <dc:creator>zhangda</dc:creator>
      <dc:date>2016-10-06T20:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the third table based on the two?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-get-the-third-table-based-on-the-two/m-p/303026#M60773</link>
      <description>&lt;P&gt;Ok...what's the relationship between the tables...&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 20:30:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-get-the-third-table-based-on-the-two/m-p/303026#M60773</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-06T20:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the third table based on the two?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-get-the-third-table-based-on-the-two/m-p/303028#M60774</link>
      <description>&lt;P&gt;That depends.&amp;nbsp; Where do EXP and REV come from if they're not part of the incoming data sets?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 20:33:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-get-the-third-table-based-on-the-two/m-p/303028#M60774</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-10-06T20:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the third table based on the two?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-get-the-third-table-based-on-the-two/m-p/303029#M60775</link>
      <description>there is no EXP and REV, I have to hard code it.</description>
      <pubDate>Thu, 06 Oct 2016 20:39:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-get-the-third-table-based-on-the-two/m-p/303029#M60775</guid>
      <dc:creator>zhangda</dc:creator>
      <dc:date>2016-10-06T20:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the third table based on the two?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-get-the-third-table-based-on-the-two/m-p/303032#M60776</link>
      <description>&lt;P&gt;OK, let's ignore REV and EXP since you will be hard-coding them.&amp;nbsp; Sort the data sets first, if they are not already sorted:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=year2015;&lt;/P&gt;
&lt;P&gt;by year;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;proc sort data=year2016;&lt;/P&gt;
&lt;P&gt;by year;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then combine them:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set year2016 (in=from2016) year2015 (in=from2015);&lt;/P&gt;
&lt;P&gt;by year;&lt;/P&gt;
&lt;P&gt;if from2016 then mid='d_2016';&lt;/P&gt;
&lt;P&gt;else mid='d_2015';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 20:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-get-the-third-table-based-on-the-two/m-p/303032#M60776</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-10-06T20:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the third table based on the two?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-get-the-third-table-based-on-the-two/m-p/303037#M60777</link>
      <description>&lt;P&gt;And another way to get something similar. Mid has the data set names here but could be modified with string functions to get D_XXXX if that format is explicitly required.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set year2015 year2016 indsname=name;
   mid=name;
run;

proc sort data=want; 
   by year mid;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Oct 2016 20:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-get-the-third-table-based-on-the-two/m-p/303037#M60777</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-06T20:53:08Z</dc:date>
    </item>
  </channel>
</rss>

