<?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: SAS Time Range in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485137#M126013</link>
    <description>&lt;P&gt;Yes, it is.&lt;/P&gt;</description>
    <pubDate>Wed, 08 Aug 2018 13:09:30 GMT</pubDate>
    <dc:creator>riccardo88</dc:creator>
    <dc:date>2018-08-08T13:09:30Z</dc:date>
    <item>
      <title>SAS Time Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485099#M126000</link>
      <description>&lt;P&gt;Hallo everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a beginner with SAS and I'm stucked on a Point.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have&amp;nbsp;a datasets of this kind:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Unbenannt.png" style="width: 430px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22319iA9C96A1CF408ECE4/image-dimensions/430x153?v=v2" width="430" height="153" role="button" title="Unbenannt.png" alt="Unbenannt.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm interested in having a dataset that contains only the data beetwen some&amp;nbsp;time ranges and delete the rest.&lt;/P&gt;&lt;P&gt;Is there a way to simplify the process with only one "if" statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Starting_time_1 = 10:02:32&lt;/P&gt;&lt;P&gt;Starting_time_2 = 10:08:52&lt;/P&gt;&lt;P&gt;Starting_time_3 = 10:21:04&lt;/P&gt;&lt;P&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;&lt;/P&gt;&lt;P&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;Time Ranges:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Starting&amp;nbsp;_time_&amp;nbsp;1 &amp;lt;= &lt;STRONG&gt;Time&lt;/STRONG&gt;&amp;nbsp;&amp;lt;=&amp;nbsp; Starting_time_1&amp;nbsp;&amp;nbsp;+ 3 Minutes&lt;/P&gt;&lt;P&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;&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; Starting&amp;nbsp;_time_&amp;nbsp;2 &amp;lt;= &lt;STRONG&gt;Time&lt;/STRONG&gt;&amp;nbsp;&amp;lt;=&amp;nbsp; Starting_time_2&amp;nbsp;&amp;nbsp;+ 3 Minutes&amp;nbsp;&lt;/P&gt;&lt;P&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;&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; Starting&amp;nbsp;_time_&amp;nbsp;3 &amp;lt;= &lt;STRONG&gt;Time&lt;/STRONG&gt;&amp;nbsp;&amp;lt;=&amp;nbsp; Starting_time_3&amp;nbsp;+ 3 Minutes&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried different ways but they didn't work.&lt;/P&gt;&lt;P&gt;I hope my explanation was clear. Thank you very much for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 12:21:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485099#M126000</guid>
      <dc:creator>riccardo88</dc:creator>
      <dc:date>2018-08-08T12:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Time Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485104#M126002</link>
      <description>&lt;P&gt;So if the time is between any of those three ranges then you keep it, if it is outside these three ranges then you don't keep it? Is that correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show us your SASLOG. Explain what went wrong.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 12:31:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485104#M126002</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-08-08T12:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Time Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485112#M126004</link>
      <description>&lt;P&gt;If your Time variable is a true SAS time, you could use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;starting_time_1 = '10:02:32't;&lt;/P&gt;
&lt;P&gt;starting_time_2 = '10:08:52't;&lt;/P&gt;
&lt;P&gt;starting_time_3 = '10:21:04't;&lt;/P&gt;
&lt;P&gt;if (starting_time_1 &amp;lt;= time &amp;lt;= starting_time_1 + 180)&lt;/P&gt;
&lt;P&gt;or (starting_time_2 &amp;lt;= time &amp;lt;= starting_time_2 + 180)&lt;/P&gt;
&lt;P&gt;or (starting_time_3 &amp;lt;= time &amp;lt;= starting_time_3 + 180);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Time variables are measured in number of seconds, so adding 180 is 3 minutes later.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 12:35:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485112#M126004</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-08-08T12:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Time Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485114#M126005</link>
      <description>&lt;P&gt;Do you yet know how dates and times are stored in SAS?&lt;/P&gt;
&lt;P&gt;Date: # of days since 1/1/11960&lt;/P&gt;
&lt;P&gt;Date time: # of secs since 1/1/1960&lt;/P&gt;
&lt;P&gt;Time: Can be a date time, where you're only showing the time; commonly, this is just the of seconds since midnight and if you were to reformat as a date time your date would be 1/1/1960.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd recommend that you convert your time to a # and make sure you know what is there. You can also do that with your thresholds. Use the SAS function hms like so:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format time1 best8.;
time1=hms(10,2,32);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Aug 2018 12:38:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485114#M126005</guid>
      <dc:creator>cau83</dc:creator>
      <dc:date>2018-08-08T12:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Time Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485115#M126006</link>
      <description>&lt;P&gt;Exaclty. If&amp;nbsp;it&amp;nbsp;is&amp;nbsp;in those ranges I Keep them (Actually I have to do it for five ranges, that was only&amp;nbsp;an example), if they are outside I delete them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think what I wrote made a lot of sense. I was&amp;nbsp;looking for a way to create a variable and then&amp;nbsp;use it in the&amp;nbsp;if&amp;nbsp;Statement but I´m not sure this is possible in SAS.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 12:38:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485115#M126006</guid>
      <dc:creator>riccardo88</dc:creator>
      <dc:date>2018-08-08T12:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Time Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485125#M126007</link>
      <description>&lt;P&gt;For "creating a variable to use in the statement" create a&amp;nbsp;&lt;EM&gt;macro variable&lt;/EM&gt;.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let time1=YOUR-TIME;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then call it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;amp;time1 &amp;lt; TIME &amp;lt; &amp;amp;time2&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Aug 2018 12:44:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485125#M126007</guid>
      <dc:creator>cau83</dc:creator>
      <dc:date>2018-08-08T12:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Time Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485132#M126009</link>
      <description>&lt;P&gt;So&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;has provided code for the case where you have 3 time ranges. It should be easy to modify if you have 5 (or any number) of time ranges.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 12:55:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485132#M126009</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-08-08T12:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Time Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485135#M126011</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;Thank you Astounding. This is my code:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; eeg_inf.out_100_test; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; eeg_inf.out_100;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;starting_time_1 = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;'10:02:32't&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;starting_time_2 = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;'10:08:52't&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;starting_time_3 = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;'10:21:04't&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; (starting_time_1 &amp;lt;= time &amp;lt;= starting_time_1 + &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;180&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;or (starting_time_2 &amp;lt;= time &amp;lt;= starting_time_2 + &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;180&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;or (starting_time_3 &amp;lt;= time &amp;lt;= starting_time_3 + &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;180&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I get a series of error Messages like this:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;NOTE: Ungültige numerische Daten, Time='10:05:34', in Zeile 1253 Spalte 24.&lt;/P&gt;&lt;P&gt;NOTE: Ungültige numerische Daten, Time='10:05:34', in Zeile 1254 Spalte 24.&lt;/P&gt;&lt;P&gt;NOTE: Ungültige numerische Daten, Time='10:05:34', in Zeile 1255 Spalte 24.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Translated from the german it means "Invalid numeric data". Is my code right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 13:01:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485135#M126011</guid>
      <dc:creator>riccardo88</dc:creator>
      <dc:date>2018-08-08T13:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Time Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485136#M126012</link>
      <description>&lt;P&gt;Seems as if your&amp;nbsp;variable TIME is character rather than numeric. Is that correct?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 13:08:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485136#M126012</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-08-08T13:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Time Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485137#M126013</link>
      <description>&lt;P&gt;Yes, it is.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 13:09:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485137#M126013</guid>
      <dc:creator>riccardo88</dc:creator>
      <dc:date>2018-08-08T13:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Time Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485143#M126015</link>
      <description>&lt;P&gt;Then you need to convert it to numeric, for example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ntime = input(time,hhmmss8.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then work with ntime&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 13:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485143#M126015</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-08-08T13:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Time Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485159#M126020</link>
      <description>It worked! Thank you very much!</description>
      <pubDate>Wed, 08 Aug 2018 14:06:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485159#M126020</guid>
      <dc:creator>riccardo88</dc:creator>
      <dc:date>2018-08-08T14:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Time Range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485160#M126021</link>
      <description>It worked! Thank you very much!!</description>
      <pubDate>Wed, 08 Aug 2018 14:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Time-Range/m-p/485160#M126021</guid>
      <dc:creator>riccardo88</dc:creator>
      <dc:date>2018-08-08T14:07:42Z</dc:date>
    </item>
  </channel>
</rss>

