<?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 delete caseIDs with timestamps on events outside of a given year in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555715#M9720</link>
    <description>&lt;P&gt;I get the error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasWarning"&gt;WARNING: A GROUP BY clause has been transformed into an ORDER BY clause because neither the SELECT clause nor the optional HAVING&amp;nbsp;clause of the associated table-expression referenced a summary function.&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;Maybe this can be of use?&lt;/DIV&gt;</description>
    <pubDate>Thu, 02 May 2019 18:32:03 GMT</pubDate>
    <dc:creator>Fantastisk</dc:creator>
    <dc:date>2019-05-02T18:32:03Z</dc:date>
    <item>
      <title>how do i delete caseIDs with timestamps on events outside of a given year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555690#M9711</link>
      <description>&lt;P&gt;Hello. I am currently trying to figure out how to delete cases which have events outside of a given year&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each caseID has several events, with timestamps. I want to create a new table with only the cases which is within a year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table test2.withinyear AS
select *
from test2.alldata
where event_time_timestamp between "01JAN18:00:00:00"dt and "31DEC18:00:00:00"dt
group by case_purchasing_document
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This does not have the effect I want, as SAS rather sorts case_purchasing_document, meaning events outside the timehorizon is deleted, which is very worrisome. Does anyone have an idea to how I can create a query in which I only select cases within 2018? Or cases starting and ending in the same year (first and last timestamp in the same year)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 17:47:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555690#M9711</guid>
      <dc:creator>Fantastisk</dc:creator>
      <dc:date>2019-05-02T17:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: how do i delete caseIDs with timestamps on events outside of a given year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555694#M9712</link>
      <description>&lt;P&gt;Do you want to keep observations where either of those conditions are true?&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 17:52:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555694#M9712</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-05-02T17:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: how do i delete caseIDs with timestamps on events outside of a given year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555695#M9713</link>
      <description>&lt;P&gt;Yes, I want to keep the observations where the "between" condition is true&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 17:58:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555695#M9713</guid>
      <dc:creator>Fantastisk</dc:creator>
      <dc:date>2019-05-02T17:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: how do i delete caseIDs with timestamps on events outside of a given year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555698#M9714</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/267150"&gt;@Fantastisk&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello. I am currently trying to figure out how to delete cases which have events outside of a given year&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Each caseID has several events, with timestamps. I want to create a new table with only the cases which is within a year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table test2.withinyear AS
select *
from test2.alldata
where event_time_timestamp between "01JAN18:00:00:00"dt and "31DEC18:00:00:00"dt
group by case_purchasing_document
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This does not have the effect I want, as SAS rather sorts case_purchasing_document, meaning events outside the timehorizon is deleted, which is very worrisome. Does anyone have an idea to how I can create a query in which I only select cases within 2018? Or cases starting and ending in the same year (first and last timestamp in the same year)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;SAS did not "delete" anything, the WHERE clause specifies which records to KEEP. If you want to keep the other records you need to be a bit more specific about what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of &lt;SPAN class="token string"&gt;"31DEC18:00:00:00"dt you may have intended "31DEC18:23:59:59"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ^ stops at midnight of 30Dec&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token string"&gt;Or &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token string"&gt;where year(datepart(event_time_timestamp))= 2018&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like you need to specify some input data and then show what the result might be as your description and "concern" appear to be in conflict.&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 18:00:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555698#M9714</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-02T18:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: how do i delete caseIDs with timestamps on events outside of a given year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555702#M9715</link>
      <description>try this below to see if it's what you need.&lt;BR /&gt;Proc sql;&lt;BR /&gt;create table test2.withinyear AS&lt;BR /&gt;select *&lt;BR /&gt;from test2.alldata&lt;BR /&gt;where year(event_time_timestamp) = 2018&lt;BR /&gt;group by case_purchasing_document&lt;BR /&gt;&lt;BR /&gt;quit;&lt;BR /&gt;</description>
      <pubDate>Thu, 02 May 2019 18:04:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555702#M9715</guid>
      <dc:creator>DMIN</dc:creator>
      <dc:date>2019-05-02T18:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: how do i delete caseIDs with timestamps on events outside of a given year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555705#M9716</link>
      <description>&lt;P&gt;You are right. It copied the events within 2018, but left out the events after and before. The other records are still stored in the other table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;each of the caseIDs have events, every event have a timestamp. Some events might start in 2017, and end in 2018, some start and end in 2018. I want to pick out only those starting and ending in same year, 2018, and store them in a new table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: Running the following code did only result in not selecting the events outside of 2018, the case is kept with less activities than before, when I want that case not to be kept as it has an event outside of 2018.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where year(datepart(event_time_timestamp))= 2018&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 May 2019 18:19:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555705#M9716</guid>
      <dc:creator>Fantastisk</dc:creator>
      <dc:date>2019-05-02T18:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: how do i delete caseIDs with timestamps on events outside of a given year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555707#M9717</link>
      <description>&lt;P&gt;this did run, but did not select any data.&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 18:15:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555707#M9717</guid>
      <dc:creator>Fantastisk</dc:creator>
      <dc:date>2019-05-02T18:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: how do i delete caseIDs with timestamps on events outside of a given year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555715#M9720</link>
      <description>&lt;P&gt;I get the error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasWarning"&gt;WARNING: A GROUP BY clause has been transformed into an ORDER BY clause because neither the SELECT clause nor the optional HAVING&amp;nbsp;clause of the associated table-expression referenced a summary function.&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;Maybe this can be of use?&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 May 2019 18:32:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555715#M9720</guid>
      <dc:creator>Fantastisk</dc:creator>
      <dc:date>2019-05-02T18:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: how do i delete caseIDs with timestamps on events outside of a given year</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555719#M9721</link>
      <description>&lt;P&gt;Solution:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc sql;
create table test2.withinyear AS
select *
from test2.allyears
group by case_concept_name
having sum(event_time_timestamp &amp;lt; "01JAN18:00:00:00"dt or event_time_timestamp &amp;gt; "31DEC18:23:59:59"dt) = 0
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Looks messy, but it works. All cases outside of 2018 is now not copied over to withinyear.&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 18:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-do-i-delete-caseIDs-with-timestamps-on-events-outside-of-a/m-p/555719#M9721</guid>
      <dc:creator>Fantastisk</dc:creator>
      <dc:date>2019-05-02T18:44:43Z</dc:date>
    </item>
  </channel>
</rss>

