<?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: Help Formatting Date and Keeping only recent entries in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-Formatting-Date-and-Keeping-only-recent-entries/m-p/797108#M255848</link>
    <description>Thank for the explanation!</description>
    <pubDate>Thu, 17 Feb 2022 22:40:23 GMT</pubDate>
    <dc:creator>SAS_learneromg</dc:creator>
    <dc:date>2022-02-17T22:40:23Z</dc:date>
    <item>
      <title>Help Formatting Date and Keeping only recent entries</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-Formatting-Date-and-Keeping-only-recent-entries/m-p/797086#M255839</link>
      <description>&lt;P&gt;I need help formatting a date as it's not something I have experience with. My variables startdate and enddate are coming in as 28Jan2000:00:00:00.000 is the data set I've been provided. How I go about making the dates just mmddyyyy and then keeping only those with a start date between 2006 and 2010?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 21:38:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-Formatting-Date-and-Keeping-only-recent-entries/m-p/797086#M255839</guid>
      <dc:creator>SAS_learneromg</dc:creator>
      <dc:date>2022-02-17T21:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help Formatting Date and Keeping only recent entries</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-Formatting-Date-and-Keeping-only-recent-entries/m-p/797101#M255843</link>
      <description>&lt;P&gt;Assuming your variable is numeric with a datetime format then you can:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Use DATEPART() to extract the date portion only&lt;/LI&gt;
&lt;LI&gt;Apply a format to have it displayed as a date&lt;/LI&gt;
&lt;LI&gt;Use the YEAR() function in an IF statement to filter the dates&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;

*extracts date portion;
date_value = datepart(dateTime);
*format, primarily for display purposes;
format date_value mmddyy10.;

*filters;
if year(date_value)  &amp;gt;= 2006 &amp;amp; year &amp;lt;=2010;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/400162"&gt;@SAS_learneromg&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I need help formatting a date as it's not something I have experience with. My variables startdate and enddate are coming in as 28Jan2000:00:00:00.000 is the data set I've been provided. How I go about making the dates just mmddyyyy and then keeping only those with a start date between 2006 and 2010?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If your datetime value is a character you will first need to convert it to a numeric datetime value:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dateTimeVar = input(charVariable, anydtdtm.);
format dateTimeVar datetime.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Feb 2022 22:02:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-Formatting-Date-and-Keeping-only-recent-entries/m-p/797101#M255843</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-02-17T22:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: Help Formatting Date and Keeping only recent entries</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-Formatting-Date-and-Keeping-only-recent-entries/m-p/797108#M255848</link>
      <description>Thank for the explanation!</description>
      <pubDate>Thu, 17 Feb 2022 22:40:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-Formatting-Date-and-Keeping-only-recent-entries/m-p/797108#M255848</guid>
      <dc:creator>SAS_learneromg</dc:creator>
      <dc:date>2022-02-17T22:40:23Z</dc:date>
    </item>
  </channel>
</rss>

