<?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 do I take previous observation if observation with certain date is missing? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-take-previous-observation-if-observation-with-certain/m-p/500345#M133233</link>
    <description>&lt;P&gt;Please provide example data (in a data step with datalines, see my footnotes), and what the result from that should be.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Oct 2018 13:27:06 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-10-01T13:27:06Z</dc:date>
    <item>
      <title>How do I take previous observation if observation with certain date is missing?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-take-previous-observation-if-observation-with-certain/m-p/500340#M133229</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset with some variables of which one is the date.&lt;/P&gt;&lt;P&gt;My problem is that I want to create a subset with a certain period between dates.&lt;/P&gt;&lt;P&gt;The program should take a given date minus a number of previous observations.&lt;/P&gt;&lt;P&gt;Like I have 30. Mar 2001 and I want to create the subset with the observations: 30. Mar 2001 - 260 observations till 30. Mar 2001 - 11 observations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to set the period with&lt;/P&gt;&lt;P&gt;where date between '30mar2001'd-260 and '30mar2001'd-11;&lt;/P&gt;&lt;P&gt;but this will only work if there is a observation for every date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope you can help.&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pascal&lt;/P&gt;</description>
      <pubDate>Mon, 01 Oct 2018 13:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-take-previous-observation-if-observation-with-certain/m-p/500340#M133229</guid>
      <dc:creator>Pascal1</dc:creator>
      <dc:date>2018-10-01T13:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I take previous observation if observation with certain date is missing?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-take-previous-observation-if-observation-with-certain/m-p/500345#M133233</link>
      <description>&lt;P&gt;Please provide example data (in a data step with datalines, see my footnotes), and what the result from that should be.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Oct 2018 13:27:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-take-previous-observation-if-observation-with-certain/m-p/500345#M133233</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-01T13:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I take previous observation if observation with certain date is missing?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-take-previous-observation-if-observation-with-certain/m-p/500354#M133239</link>
      <description>&lt;P&gt;While your question is not particularly clear, here is an approach you can tailor to your needs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=have out=subset;&lt;/P&gt;
&lt;P&gt;by descending date;&lt;/P&gt;
&lt;P&gt;where date &amp;lt;= '30mar2001'd;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set subset;&lt;/P&gt;
&lt;P&gt;**** Now you can add your own logic here that depends on the date and/or&lt;/P&gt;
&lt;P&gt;&amp;nbsp; _N_ which will number the observations beginning with March 30 having _N_=1. ;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Oct 2018 13:39:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-take-previous-observation-if-observation-with-certain/m-p/500354#M133239</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-10-01T13:39:45Z</dc:date>
    </item>
  </channel>
</rss>

