<?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 do I Update a date field with today's in datetime format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Update-a-date-field-with-today-s-in-datetime-format/m-p/793458#M254340</link>
    <description>&lt;P&gt;Greetings&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a table that has a datetime field and would like to update the field with today's date using the datetime format.&lt;/P&gt;
&lt;P&gt;I have seen a way of updating a number field&amp;nbsp; by doing this in the attached dataset:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc sql;&lt;/P&gt;
&lt;P&gt;update test2&lt;/P&gt;
&lt;P&gt;set hour = 50;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;The code updates all values of the field "Hour"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to update the field Date with today's date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Furthermore, it might be required to update only a specific record say where name = 'John'. will there also be a way of updating specific record?&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
    <pubDate>Mon, 31 Jan 2022 12:26:11 GMT</pubDate>
    <dc:creator>mmohotsi</dc:creator>
    <dc:date>2022-01-31T12:26:11Z</dc:date>
    <item>
      <title>How do I Update a date field with today's in datetime format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Update-a-date-field-with-today-s-in-datetime-format/m-p/793458#M254340</link>
      <description>&lt;P&gt;Greetings&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a table that has a datetime field and would like to update the field with today's date using the datetime format.&lt;/P&gt;
&lt;P&gt;I have seen a way of updating a number field&amp;nbsp; by doing this in the attached dataset:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc sql;&lt;/P&gt;
&lt;P&gt;update test2&lt;/P&gt;
&lt;P&gt;set hour = 50;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;The code updates all values of the field "Hour"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to update the field Date with today's date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Furthermore, it might be required to update only a specific record say where name = 'John'. will there also be a way of updating specific record?&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 12:26:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Update-a-date-field-with-today-s-in-datetime-format/m-p/793458#M254340</guid>
      <dc:creator>mmohotsi</dc:creator>
      <dc:date>2022-01-31T12:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Update a date field with today's in datetime format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Update-a-date-field-with-today-s-in-datetime-format/m-p/793460#M254342</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc sql;
   update test2
   set hour = datetime
   where name = 'John';
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Jan 2022 12:28:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Update-a-date-field-with-today-s-in-datetime-format/m-p/793460#M254342</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-01-31T12:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Update a date field with today's in datetime format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Update-a-date-field-with-today-s-in-datetime-format/m-p/793462#M254344</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc sql;
    update test2 set date = datetime();
    alter table test2 modify date integer format=datetime16.;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now test2 is a datetime value. NOTE: in some places you ask for a datetime value, and in other places you ask for a date value, which is it?&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 12:39:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Update-a-date-field-with-today-s-in-datetime-format/m-p/793462#M254344</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-31T12:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I Update a date field with today's in datetime format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-Update-a-date-field-with-today-s-in-datetime-format/m-p/797584#M313568</link>
      <description>&lt;P&gt;Greetings&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The solution worked perfectly. The customer request that I format today's date as a datetime field to a format 2022-02-21 13:56:45. This format starts with a year as it will suits his database field&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The datetime in the accepted solution provides a datetime format that starts with the day and not the year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to update the field with this format?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 12:10:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-Update-a-date-field-with-today-s-in-datetime-format/m-p/797584#M313568</guid>
      <dc:creator>mmohotsi</dc:creator>
      <dc:date>2022-02-21T12:10:26Z</dc:date>
    </item>
  </channel>
</rss>

