<?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: retain first of a type and first of another type in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/retain-first-of-a-type-and-first-of-another-type/m-p/341660#M78228</link>
    <description>&lt;P&gt;You'll probably see a few somewhat similar solutions.&amp;nbsp; Here's the variation I would use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;by caseid type notsorted;&lt;/P&gt;
&lt;P&gt;if (first.type and type='typex') or (last.type and type='typey');&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have to match whatever is in your data (is it "typey" or "type y" for example).&lt;/P&gt;</description>
    <pubDate>Thu, 16 Mar 2017 16:24:55 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-03-16T16:24:55Z</dc:date>
    <item>
      <title>retain first of a type and first of another type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/retain-first-of-a-type-and-first-of-another-type/m-p/341630#M78218</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I got a large numbers of events which is a sort of interval where I want to count days from a start event point (date)&amp;nbsp; to an end point(another date). I need the first start1 og end1/end2 in every interval. Do you have any smart suggestion to do that? after the specific observation has been output i will count the days by retain. Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;idx start1 -----&amp;gt;&lt;/P&gt;&lt;P&gt;idx start1&lt;/P&gt;&lt;P&gt;idx start1&lt;/P&gt;&lt;P&gt;idx end1-------&amp;gt;&lt;/P&gt;&lt;P&gt;idx start1 -----&amp;gt;&lt;/P&gt;&lt;P&gt;idx start1&lt;/P&gt;&lt;P&gt;idx start1&lt;/P&gt;&lt;P&gt;idx end1-------&amp;gt;&lt;/P&gt;&lt;P&gt;idy start1 -----&amp;gt;&lt;/P&gt;&lt;P&gt;idy start1&lt;/P&gt;&lt;P&gt;idy start1&lt;/P&gt;&lt;P&gt;idy end2-------&amp;gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 15:40:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/retain-first-of-a-type-and-first-of-another-type/m-p/341630#M78218</guid>
      <dc:creator>ANLYNG</dc:creator>
      <dc:date>2017-03-16T15:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: retain first of a type and first of another type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/retain-first-of-a-type-and-first-of-another-type/m-p/341642#M78222</link>
      <description>&lt;P&gt;Is that your sample data? Please show what you want as output and make sure your sample data is reflective of your actual data.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 15:54:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/retain-first-of-a-type-and-first-of-another-type/m-p/341642#M78222</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-16T15:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: retain first of a type and first of another type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/retain-first-of-a-type-and-first-of-another-type/m-p/341646#M78224</link>
      <description>&lt;P&gt;Show test data&amp;nbsp;&lt;STRONG&gt; in the form of a datastep&lt;/STRONG&gt; and what what you want the output to look like. &amp;nbsp;We can't tell anything from what you have posted.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 15:59:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/retain-first-of-a-type-and-first-of-another-type/m-p/341646#M78224</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-03-16T15:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: retain first of a type and first of another type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/retain-first-of-a-type-and-first-of-another-type/m-p/341653#M78227</link>
      <description>&lt;P&gt;The data is case date events and I want the first typex as startpoint date and always typey as end date. I think I need a counter which os reset by the endtype??? any suggestions are welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my data looks like this&lt;/P&gt;&lt;P&gt;caseid, date, type&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;122220 12/7/2016 typex -----&amp;gt;want this one in output, first typex.sorted by date and caseid&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;122220 7/8/2016 typex&lt;/P&gt;&lt;P&gt;122220 7/9/2016 type x&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;122220 10/10/2016 typey-------&amp;gt;want this one in output, type y&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;122220 17/10/2016 typex -----&amp;gt;want this one in output, first typex, sorted by date and caseid&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;122220 24/10/2016 typex&lt;/P&gt;&lt;P&gt;122220 7/9/2016 typex&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;122220 10/10/2016 typey-------&amp;gt;want this one in output, type y&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;122300 3/3/2016 typex -----&amp;gt;want this one in output, first typex sorted by date and caseid&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;122300 10/3/2016 typex&lt;/P&gt;&lt;P&gt;122300&amp;nbsp;7/9/2016 typex&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;122300 10/10/2016 type y-------&amp;gt;want this one in output, type y&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;122300&amp;nbsp;17/10/2016 typex -----&amp;gt;want this one in output, first typex, sorted by date and caseid&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;122300&amp;nbsp;24/10/2016 typex&lt;/P&gt;&lt;P&gt;122300 26/10/2016 type x&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;122300 26/11/2016 type y-------&amp;gt;want this one in output, type y&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 16:17:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/retain-first-of-a-type-and-first-of-another-type/m-p/341653#M78227</guid>
      <dc:creator>ANLYNG</dc:creator>
      <dc:date>2017-03-16T16:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: retain first of a type and first of another type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/retain-first-of-a-type-and-first-of-another-type/m-p/341660#M78228</link>
      <description>&lt;P&gt;You'll probably see a few somewhat similar solutions.&amp;nbsp; Here's the variation I would use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;by caseid type notsorted;&lt;/P&gt;
&lt;P&gt;if (first.type and type='typex') or (last.type and type='typey');&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have to match whatever is in your data (is it "typey" or "type y" for example).&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 16:24:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/retain-first-of-a-type-and-first-of-another-type/m-p/341660#M78228</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-16T16:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: retain first of a type and first of another type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/retain-first-of-a-type-and-first-of-another-type/m-p/342164#M78426</link>
      <description>&lt;P&gt;great simple solutionwhich works as wanted - thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2017 21:35:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/retain-first-of-a-type-and-first-of-another-type/m-p/342164#M78426</guid>
      <dc:creator>ANLYNG</dc:creator>
      <dc:date>2017-03-17T21:35:23Z</dc:date>
    </item>
  </channel>
</rss>

