<?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 How to delete observations with same hour in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-observations-with-same-hour/m-p/103912#M21705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm just trying to delete some obs - the ones that are created at the same date and hour.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a column "creation_time" from which I extrat the creation_hour by using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;attrib&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; creation_hour&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length = 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format = hour.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;creation_hour = timepart(creation_time);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(That doesn't work as I expected it to because '11:47:32' becomes '12' but that is not really important for my task.)&lt;/P&gt;&lt;P&gt;But there is an actual problem: Even if '11:47:32' and '11:48:01' both lead to '12' the two obs still remain, if I try to delete one of them by using &lt;/P&gt;&lt;P&gt;proc sort nodupkey:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by creation_hour;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That means the column creation_hour actually still contains the whole information, with minutes and seconds, doesn't it?&lt;/P&gt;&lt;P&gt;How can I change this? I really only want the column to contain the numbers from 1-12 - is that possible? How?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or is there a better way to do the job?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any ideas &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Jun 2013 14:15:37 GMT</pubDate>
    <dc:creator>Marian_2127</dc:creator>
    <dc:date>2013-06-12T14:15:37Z</dc:date>
    <item>
      <title>How to delete observations with same hour</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-observations-with-same-hour/m-p/103912#M21705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm just trying to delete some obs - the ones that are created at the same date and hour.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a column "creation_time" from which I extrat the creation_hour by using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;attrib&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; creation_hour&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length = 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format = hour.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;creation_hour = timepart(creation_time);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(That doesn't work as I expected it to because '11:47:32' becomes '12' but that is not really important for my task.)&lt;/P&gt;&lt;P&gt;But there is an actual problem: Even if '11:47:32' and '11:48:01' both lead to '12' the two obs still remain, if I try to delete one of them by using &lt;/P&gt;&lt;P&gt;proc sort nodupkey:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by creation_hour;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That means the column creation_hour actually still contains the whole information, with minutes and seconds, doesn't it?&lt;/P&gt;&lt;P&gt;How can I change this? I really only want the column to contain the numbers from 1-12 - is that possible? How?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or is there a better way to do the job?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any ideas &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jun 2013 14:15:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-observations-with-same-hour/m-p/103912#M21705</guid>
      <dc:creator>Marian_2127</dc:creator>
      <dc:date>2013-06-12T14:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete observations with same hour</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-observations-with-same-hour/m-p/103913#M21706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Creation_hour= hour(creation_time);&lt;/P&gt;&lt;P&gt;Should return just the hour.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jun 2013 14:51:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-observations-with-same-hour/m-p/103913#M21706</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-06-12T14:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete observations with same hour</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-observations-with-same-hour/m-p/103914#M21707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the idea but unfortunately, this doesn't return the hour. Now creation_hour equals zero for all obs - without any errors or anything in the log.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 07:02:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-observations-with-same-hour/m-p/103914#M21707</guid>
      <dc:creator>Marian_2127</dc:creator>
      <dc:date>2013-06-13T07:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete observations with same hour</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-observations-with-same-hour/m-p/103915#M21708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why do you apply the hour-format to creation_hour? I think the problems are a result of applying the format.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 10:59:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-observations-with-same-hour/m-p/103915#M21708</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2013-06-13T10:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete observations with same hour</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-observations-with-same-hour/m-p/103916#M21709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, I see.&lt;/P&gt;&lt;P&gt;I used the format 'hour' because with &lt;/P&gt;&lt;P&gt;"creation_hour = timepart(creation_time); "&lt;/P&gt;&lt;P&gt;without this format, the column creation_hour contained numbers from zero to 86.399 (counting the seconds).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But with the correction &lt;BR /&gt;"creation_hour = hour(creation_time); "&lt;/P&gt;&lt;P&gt;the format is indeed not necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot to both of you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 11:09:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-observations-with-same-hour/m-p/103916#M21709</guid>
      <dc:creator>Marian_2127</dc:creator>
      <dc:date>2013-06-13T11:09:05Z</dc:date>
    </item>
  </channel>
</rss>

