<?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: Code for time and day of the week ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630962#M186869</link>
    <description>&lt;P&gt;how?&lt;/P&gt;</description>
    <pubDate>Tue, 10 Mar 2020 15:34:07 GMT</pubDate>
    <dc:creator>SASforHealth</dc:creator>
    <dc:date>2020-03-10T15:34:07Z</dc:date>
    <item>
      <title>Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630047#M186470</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I have a variable that have date and time. Is there a code to identify the day of the week and time of the day from this unformatted variable? Thanks in advance!</description>
      <pubDate>Fri, 06 Mar 2020 12:04:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630047#M186470</guid>
      <dc:creator>SASforHealth</dc:creator>
      <dc:date>2020-03-06T12:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630048#M186471</link>
      <description />
      <pubDate>Fri, 06 Mar 2020 12:04:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630048#M186471</guid>
      <dc:creator>SASforHealth</dc:creator>
      <dc:date>2020-03-06T12:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630049#M186472</link>
      <description>&lt;P&gt;Is the variable chracter or an actual SAS Datetime value?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 12:05:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630049#M186472</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-03-06T12:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630052#M186473</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/315421"&gt;@SASforHealth&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming the variable is a SAS datetime you can do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
format dt datetime18. time time10.;
dt = "06MAR2020 12:36"dt;
day = weekday(datepart(dt));  
time = timepart(dt);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Assuming it is a character string:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
format. time time10.;
dt = input("06MAR2020 12:36", datetime18.);
day = weekday(datepart(dt));
time = timepart(dt);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Mar 2020 12:28:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630052#M186473</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-03-06T12:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630136#M186501</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/315421"&gt;@SASforHealth&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi all,&lt;BR /&gt;&lt;BR /&gt;I have a variable that have date and time. Is there a code to identify the day of the week and time of the day from this unformatted variable? Thanks in advance!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please help us help you by showing what you have and whether that is a SAS character variable or not.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 16:19:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630136#M186501</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-06T16:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630927#M186848</link>
      <description>&lt;P&gt;it is a character value ($32,000.00 )&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 14:16:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630927#M186848</guid>
      <dc:creator>SASforHealth</dc:creator>
      <dc:date>2020-03-10T14:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630942#M186859</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/315421"&gt;@SASforHealth&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;it is a character value ($32,000.00 )&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then fix that issue first and transform it to be a more useful sas-datetime-variable.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 14:48:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630942#M186859</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-03-10T14:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630961#M186868</link>
      <description>&lt;P&gt;my current variable is&amp;nbsp;Incident_DateTime with a character value of&amp;nbsp;$32000 but the date represents a true sas date and time (ex. value=43323.24039351852). I have attempted both of your codes but I am not having success. I am stuck and not sure how to switch it to a sas date time variable. In your example could you please use my variable name to reduce confusion. thanks so much!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 15:42:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630961#M186868</guid>
      <dc:creator>SASforHealth</dc:creator>
      <dc:date>2020-03-10T15:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630962#M186869</link>
      <description>&lt;P&gt;how?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 15:34:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630962#M186869</guid>
      <dc:creator>SASforHealth</dc:creator>
      <dc:date>2020-03-10T15:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630977#M186877</link>
      <description>&lt;P&gt;I used code:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Date2 =DATEPART(Incident_DateTime);&lt;BR /&gt;Time= TIMEPART (Incident_DateTime);&lt;/P&gt;&lt;P&gt;now my time is correct and my date is falsely "01JAN1960" any suggestions? My true date values are present date&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 15:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630977#M186877</guid>
      <dc:creator>SASforHealth</dc:creator>
      <dc:date>2020-03-10T15:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630978#M186878</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/315421"&gt;@SASforHealth&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;my current variable is&amp;nbsp;Incident_DateTime with a character value of&amp;nbsp;$32000 but the date represents a true sas date and time (ex. value=43323.24039351852). I have attempted both of your codes but I am not having success. I am stuck and not sure how to switch it to a sas date time variable. In your example could you please use my variable name to reduce confusion. thanks so much!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That helps.&amp;nbsp; I was wondering how you were planning to convert a value like '$32000' in a date time.&lt;/P&gt;
&lt;P&gt;Those numbers do NOT look like date time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please explain what date and time the value 43,323.24039351852 is supposed to be?&lt;/P&gt;
&lt;P&gt;Is that supposed to be number of days and fractions of a day?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What date does the number 43,323 represent?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 15:55:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630978#M186878</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-10T15:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630980#M186880</link>
      <description>&lt;P&gt;sometime in the past 3 years 2017-2020, i am not sure of the date as this is my only date time variable.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 16:01:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630980#M186880</guid>
      <dc:creator>SASforHealth</dc:creator>
      <dc:date>2020-03-10T16:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630982#M186881</link>
      <description>&lt;P&gt;Perhaps it is counting days since 1900 instead of since 1960 like SAS does?&lt;/P&gt;
&lt;PRE&gt;1612  data test;
1613    dt1=dhms(43323.24039351852,0,0,0);
1614    dt2=dt1+'01Jan1900:00:00'dt;
1615
1616
1617    put (_all_) (= comma25.4);
1618    put (_all_) (= datetime25.4);
1619  run;

dt1=3,743,127,970.0000 dt2=1,849,758,370.0000
dt1=12AUG2078:05:46:10.0000 dt2=13AUG2018:05:46:10.0000
&lt;/PRE&gt;
&lt;P&gt;If so then that value looks like it represents: 13AUG2018:05:46:10&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 16:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630982#M186881</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-10T16:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630984#M186882</link>
      <description>&lt;P&gt;ahh okay not sure why it is doing that, how odd? can you please help me craft the code then to get my&amp;nbsp;Incident_DateTime into normal date, time, and day of week formats?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 16:04:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/630984#M186882</guid>
      <dc:creator>SASforHealth</dc:creator>
      <dc:date>2020-03-10T16:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Code for time and day of the week ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/631160#M186965</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/315421"&gt;@SASforHealth&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;how?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Depends on the actual values you have, see the post of &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt; for a hint on how to convert text to a datetime. You could post example data, so that code could be suggested.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 05:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-for-time-and-day-of-the-week/m-p/631160#M186965</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-03-11T05:57:55Z</dc:date>
    </item>
  </channel>
</rss>

