<?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: Need help with code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-code/m-p/491715#M129028</link>
    <description>Sorry abt that my lack of explaining ... paper is order of ticket day and dep is date2 of service&lt;BR /&gt;&lt;BR /&gt;Whst im looking for is based on the day of paper ticket day table when was the last date2 service from the dep1 table&lt;BR /&gt;These 1st 3 col come paper. Date2 comes from dep1&lt;BR /&gt;Id. Seq. Day. Date2. Diff&lt;BR /&gt;A1. 9401. 05/18/2018. 04/27/2018. 21&lt;BR /&gt;&lt;BR /&gt;I think my issue might be seq number</description>
    <pubDate>Fri, 31 Aug 2018 18:54:16 GMT</pubDate>
    <dc:creator>Gil_</dc:creator>
    <dc:date>2018-08-31T18:54:16Z</dc:date>
    <item>
      <title>Need help with code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-code/m-p/491707#M129023</link>
      <description>I have a code gives me last services&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table temp as select&lt;BR /&gt;A.id,&lt;BR /&gt;A.seq,&lt;BR /&gt;A.day,&lt;BR /&gt;B.date1 as date2,&lt;BR /&gt;Abs(a day-b.date1) as diff&lt;BR /&gt;From paper as a&lt;BR /&gt;Left join dep1 as b&lt;BR /&gt;On a.id=b.id&lt;BR /&gt;Group by a.id&lt;BR /&gt;Order by id seq, diff&lt;BR /&gt;&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table want&lt;BR /&gt;As select id,day,date2, seq&lt;BR /&gt;From temp&lt;BR /&gt;Group by id , seq&lt;BR /&gt;Having min(diff)&lt;BR /&gt;;quit;&lt;BR /&gt;&lt;BR /&gt;Data want;&lt;BR /&gt;Set temp;&lt;BR /&gt;By id seq&lt;BR /&gt;If first.seq;&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;It works 80%of time&lt;BR /&gt;&lt;BR /&gt;Id. Seq. Day. Date2. Diff&lt;BR /&gt;A1. 9401. 05/18/2018. 05/25/2018. 7&lt;BR /&gt;&lt;BR /&gt;What i expect was&lt;BR /&gt;Id. Seq. Day. Date2. Diff&lt;BR /&gt;A1. 9401. 05/18/2018. 04/27/2018. 21&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;What im looking for last day there was a service from 5/18/2018. Whichj is 04/27/2018</description>
      <pubDate>Fri, 31 Aug 2018 18:18:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-code/m-p/491707#M129023</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2018-08-31T18:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-code/m-p/491710#M129025</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some sample data and explanation would really improve things. Paper? Dep1?&amp;nbsp; These things have meaning?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without investing too much, I'll hazard that right now you are finding the closest date before or after and what you really want is the closest date before. I'll further hazard that a WHERE clause like "where table1.date &amp;lt; table2.date" might move you in that direction.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 18:40:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-code/m-p/491710#M129025</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2018-08-31T18:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-code/m-p/491715#M129028</link>
      <description>Sorry abt that my lack of explaining ... paper is order of ticket day and dep is date2 of service&lt;BR /&gt;&lt;BR /&gt;Whst im looking for is based on the day of paper ticket day table when was the last date2 service from the dep1 table&lt;BR /&gt;These 1st 3 col come paper. Date2 comes from dep1&lt;BR /&gt;Id. Seq. Day. Date2. Diff&lt;BR /&gt;A1. 9401. 05/18/2018. 04/27/2018. 21&lt;BR /&gt;&lt;BR /&gt;I think my issue might be seq number</description>
      <pubDate>Fri, 31 Aug 2018 18:54:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-code/m-p/491715#M129028</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2018-08-31T18:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-code/m-p/491758#M129045</link>
      <description>Ok got it to work. I do have a question&lt;BR /&gt;Id. Day. Date2. Seq. Diff&lt;BR /&gt;Id1. 05/18/2018. 05/15/3018. 9401. 3&lt;BR /&gt;&lt;BR /&gt;Id1. 05/18/2018. 04/27/3018. 9401. 21&lt;BR /&gt;&lt;BR /&gt;Id1. 05/18/2018. 04/11/3018. 9401. 37&lt;BR /&gt;&lt;BR /&gt;Id1. 05/18/2018. 04/02/3018. 9401. 46&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;How do i extract&lt;BR /&gt;Id1. 05/18/2018. 05/15/3018. 9401. 3&lt;BR /&gt;And disregard the rest ...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Aug 2018 21:00:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-code/m-p/491758#M129045</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2018-08-31T21:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-code/m-p/491768#M129054</link>
      <description>&lt;P&gt;My basic approach would look something like this if I understand the rule:&lt;/P&gt;
&lt;PRE&gt;proc sort data=have;
   by id descending day descending date2;
run;

data want;
   set have;
   by id ;
   if first.id;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Aug 2018 22:05:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-code/m-p/491768#M129054</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-08-31T22:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-with-code/m-p/491773#M129059</link>
      <description>Thank you</description>
      <pubDate>Fri, 31 Aug 2018 22:41:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-with-code/m-p/491773#M129059</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2018-08-31T22:41:11Z</dc:date>
    </item>
  </channel>
</rss>

