<?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: Changing the date for one observation: date format MMDDYY8. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749623#M235607</link>
    <description>&lt;P&gt;You are close. Here is the way to do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if IDvar eq "ABCD" then datevar = '03AUG2020'd;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It has to be that exact syntax, except that it can be upper or lower or mixed case.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jun 2021 16:28:08 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-06-22T16:28:08Z</dc:date>
    <item>
      <title>Changing the date for one observation: date format MMDDYY8.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749621#M235605</link>
      <description>&lt;DIV class="branch"&gt;
&lt;DIV align="center"&gt;
&lt;P class="lia-align-left"&gt;I have a Date column that is numeric with format MMDDYY8. I want to modify one of the dates in my dataset. I tried the following code to change the date for a specific ID participant:&lt;/P&gt;
&lt;P class="lia-align-left"&gt;data want;&lt;/P&gt;
&lt;P class="lia-align-left"&gt;set have;&lt;/P&gt;
&lt;P class="lia-align-left"&gt;if IDvar eq "ABCD" then datevar = 03/08/20;&lt;/P&gt;
&lt;P class="lia-align-left"&gt;run;&lt;/P&gt;
&lt;TABLE class="table" summary="Procedure Contents: Varnum" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;Type&amp;nbsp;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;Ln&amp;nbsp; &amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;Format&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="branch"&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Contents: Varnum" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;Num&lt;/TD&gt;
&lt;TD class="r data"&gt;8&lt;/TD&gt;
&lt;TD class="l data"&gt;MMDDYY8.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P class="lia-align-left"&gt;but instead of the date I want, I got&amp;nbsp; 01/01/60&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.BIO_WAVES_DERIVE" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;01/01/60&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P class="lia-align-left"&gt;May you please help me solve this?&lt;/P&gt;
&lt;P class="lia-align-left"&gt;Thanks!&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 22 Jun 2021 16:22:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749621#M235605</guid>
      <dc:creator>Emma_at_SAS</dc:creator>
      <dc:date>2021-06-22T16:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the date for one observation: date format MMDDYY8.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749622#M235606</link>
      <description>You need to provide dates in a specific format, "08Mar2020"d -&amp;gt; I would always recommend using a 4 digit year as well. &lt;BR /&gt;&lt;BR /&gt;if idvar = 'ABCD" then datevar = '08Mar2020'd;&lt;BR /&gt;&lt;BR /&gt;Jump to the section on Dates/DateTimes here:&lt;BR /&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lrcon/p0cq7f0icfjr8vn19vyunwmmsl7m.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lrcon/p0cq7f0icfjr8vn19vyunwmmsl7m.htm&lt;/A&gt;</description>
      <pubDate>Tue, 22 Jun 2021 16:28:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749622#M235606</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-22T16:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the date for one observation: date format MMDDYY8.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749623#M235607</link>
      <description>&lt;P&gt;You are close. Here is the way to do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if IDvar eq "ABCD" then datevar = '03AUG2020'd;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It has to be that exact syntax, except that it can be upper or lower or mixed case.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 16:28:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749623#M235607</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-22T16:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the date for one observation: date format MMDDYY8.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749629#M235612</link>
      <description>&lt;P&gt;3 divided by 8 divided by 20 is&amp;nbsp;0.01875 which is less than 1.&amp;nbsp; So 01JAN1960 is the right date for the value you stored.&lt;/P&gt;
&lt;P&gt;Did you intend to set the date to the 08MAR2020?&amp;nbsp; Or perhaps 08MAR1920?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so then you can either use a date literal (a quoted string that the DATE informat can read followed by the letter d) or a function that returns that date or the actual date value of&amp;nbsp;21982.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;datevar = '08mar2020'd;
datevar = "8MAR2020"d;
datevar = '01-mar-2020'd;
datevar = mdy(3,8,2020);
datevar = 21982 ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 16:45:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749629#M235612</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-22T16:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the date for one observation: date format MMDDYY8.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749631#M235614</link>
      <description>&lt;P&gt;Thank you, Reeza,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="lia-link-navigation lia-page-link lia-user-name-link" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892" target="_blank"&gt;&lt;SPAN class="login-bold"&gt;PaigeMiller&lt;/SPAN&gt;&lt;/A&gt;, and Tom. All your answers were very helpful and I learned from each response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 16:49:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749631#M235614</guid>
      <dc:creator>Emma_at_SAS</dc:creator>
      <dc:date>2021-06-22T16:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the date for one observation: date format MMDDYY8.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749635#M235617</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/84351"&gt;@Emma_at_SAS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm glad you got an answer you can use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If can make a suggestion, from now on you'd be better off using 4 digit years, rather than 2 digit years. This will avoid complications and confusion at some point in your programming career.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 16:55:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749635#M235617</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-22T16:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the date for one observation: date format MMDDYY8.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749659#M235631</link>
      <description>Thank you, PaigeMiller! I very much appreciate your advice! I agree that is great advice and I will follow that!</description>
      <pubDate>Tue, 22 Jun 2021 18:21:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749659#M235631</guid>
      <dc:creator>Emma_at_SAS</dc:creator>
      <dc:date>2021-06-22T18:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the date for one observation: date format MMDDYY8.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749661#M235632</link>
      <description>Tom, may I ask how you calculated 21982? &lt;BR /&gt;Thanks!</description>
      <pubDate>Tue, 22 Jun 2021 18:25:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749661#M235632</guid>
      <dc:creator>Emma_at_SAS</dc:creator>
      <dc:date>2021-06-22T18:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the date for one observation: date format MMDDYY8.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749662#M235633</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/84351"&gt;@Emma_at_SAS&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Tom, may I ask how you calculated 21982? &lt;BR /&gt;Thanks!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just ask SAS to show you.&lt;/P&gt;
&lt;PRE&gt;208   data test;
209     x=mdy(3,8,20);
210     put x=;
211   run;

x=21982
&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Jun 2021 18:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749662#M235633</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-22T18:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the date for one observation: date format MMDDYY8.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749663#M235634</link>
      <description>Great! Thanks!</description>
      <pubDate>Tue, 22 Jun 2021 18:28:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-the-date-for-one-observation-date-format-MMDDYY8/m-p/749663#M235634</guid>
      <dc:creator>Emma_at_SAS</dc:creator>
      <dc:date>2021-06-22T18:28:49Z</dc:date>
    </item>
  </channel>
</rss>

