<?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 select only required obs when concatenating datassets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349185#M80970</link>
    <description>&lt;P&gt;Thank you for the support.&lt;/P&gt;&lt;P&gt;But I need to concatenate the datasets, not merging. Thank you&lt;/P&gt;</description>
    <pubDate>Tue, 11 Apr 2017 16:23:27 GMT</pubDate>
    <dc:creator>knveraraju91</dc:creator>
    <dc:date>2017-04-11T16:23:27Z</dc:date>
    <item>
      <title>how to select only required obs when concatenating datassets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349178#M80967</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;&lt;P&gt;I need to concatenate the datasets "one and two" to &amp;nbsp;get last date from data two.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In data two there are more &amp;nbsp;subjects than data one. I need to have in my output only subjects that are in dataone. Please help . Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data one;
input id date date9.
datalines;
1 05OCT2015
2 06OCT2015
3 07OCT2015
;
data two;
input id date date9.;
datalines;
1 05DEC2015
2 06DEC2015
3 07DEC2015 
4 08DEC2015
;&lt;/PRE&gt;&lt;P&gt;code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data three;&lt;/P&gt;&lt;P&gt;set one two;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output needed;&lt;/P&gt;&lt;P&gt;id date&lt;/P&gt;&lt;P&gt;1 05OCT2015&lt;BR /&gt;2 06OCT2015&lt;BR /&gt;3 07OCT2015&lt;/P&gt;&lt;P&gt;1 05DEC2015&lt;BR /&gt;2 06DEC2015&lt;BR /&gt;3 07DEC2015&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 15:57:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349178#M80967</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2017-04-11T15:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to select only required obs when concatenating datassets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349181#M80968</link>
      <description>&lt;P&gt;UNTESTED CODE&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    merge one(in=in1 rename=(date=date1)) two(in=in2 rename=(date=date2));
    by id;
    if in1 and in2;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Apr 2017 16:13:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349181#M80968</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-04-11T16:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to select only required obs when concatenating datassets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349182#M80969</link>
      <description>&lt;P&gt;A silly solution, forgive me but fun:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data one;&lt;BR /&gt;input id date :date9.;&lt;BR /&gt;format date date9.;&lt;BR /&gt;datalines;&lt;BR /&gt;1 05OCT2015&lt;BR /&gt;2 06OCT2015&lt;BR /&gt;3 07OCT2015&lt;BR /&gt;;&lt;BR /&gt;data two;&lt;BR /&gt;input id date :date9.;&lt;BR /&gt;format date date9.;&lt;BR /&gt;datalines;&lt;BR /&gt;1 05DEC2015&lt;BR /&gt;2 06DEC2015&lt;BR /&gt;3 07DEC2015&lt;BR /&gt;4 08DEC2015&lt;BR /&gt;;&lt;BR /&gt;data temp;&lt;BR /&gt;merge one(in=a) two(in=b);&lt;BR /&gt;by id;&lt;BR /&gt;if a and b;&lt;BR /&gt;run;&lt;BR /&gt;data want;&lt;BR /&gt;set one temp;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 16:15:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349182#M80969</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-04-11T16:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to select only required obs when concatenating datassets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349185#M80970</link>
      <description>&lt;P&gt;Thank you for the support.&lt;/P&gt;&lt;P&gt;But I need to concatenate the datasets, not merging. Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 16:23:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349185#M80970</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2017-04-11T16:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to select only required obs when concatenating datassets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349198#M80975</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;But I need to concatenate the datasets, not merging. Thank you&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In that case &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;has provided the solution.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 17:15:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349198#M80975</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-04-11T17:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to select only required obs when concatenating datassets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349205#M80978</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data three;
   set one(in=in1) two(in=in2);
   by id;
   if first.id and in2 then delete;
   format date date9.;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG title="Capture.PNG" alt="Capture.PNG" src="https://communities.sas.com/t5/image/serverpage/image-id/8282iADE731EEBF586EC7/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 17:35:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349205#M80978</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2017-04-11T17:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to select only required obs when concatenating datassets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349450#M81050</link>
      <description>&lt;PRE&gt;
Assuming there are not duplicated ID in both tables.



data one;
input id date :date9.;
format date date9.;
datalines;
1 05OCT2015
2 06OCT2015
3 07OCT2015
;
data two;
input id date :date9.;
format date date9.;
datalines;
1 05DEC2015
2 06DEC2015
3 07DEC2015
4 08DEC2015
;
data want;
 set one two;
 by id;
 if first.id and last.id then delete;
run;


&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Apr 2017 13:46:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-select-only-required-obs-when-concatenating-datassets/m-p/349450#M81050</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-04-12T13:46:13Z</dc:date>
    </item>
  </channel>
</rss>

