<?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: Date format in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Date-format/m-p/880473#M39068</link>
    <description>&lt;P&gt;Variable birth_date is a character variable.&amp;nbsp; Dates in SAS &lt;EM&gt;must&lt;/EM&gt; be numeric. You have to create a numeric variable with that value and then format the numeric variable. In this case, the values like 21658 and 31193 may be recognizable by SAS as dates, or they may have come over from Excel in which case &lt;A href="https://support.sas.com/resources/papers/proceedings/proceedings/sugi29/068-29.pdf" target="_self"&gt;additional manipulation&lt;/A&gt; is needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    num_birth_date=input(birth_date,12.);
    format num_birth_date mmddyy10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Side issue: if at all possible, avoid storing dates as characters. Store them in numeric SAS variables, in a form that SAS will recognize, which is the number of days since 01JAN1960, formatted however you want.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Jun 2023 16:47:18 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-06-13T16:47:18Z</dc:date>
    <item>
      <title>Date format</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format/m-p/880472#M39067</link>
      <description>&lt;P&gt;I am trying to format the date in a dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;examples in the column for date are: 21658, 31193 &lt;/P&gt;
&lt;P&gt;I have used different approaches (e.g., date9.,&amp;nbsp;&lt;SPAN&gt;MMDDYY10.&lt;/SPAN&gt; ) but unable to format the date&lt;/P&gt;
&lt;P&gt;Please advise. The date appears as such using proc contents:&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="60"&gt;
&lt;P&gt;&lt;STRONG&gt;#&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="86"&gt;
&lt;P&gt;&lt;STRONG&gt;Variable&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="65"&gt;
&lt;P&gt;&lt;STRONG&gt;Type&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;&lt;STRONG&gt;Len&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="69"&gt;
&lt;P&gt;&lt;STRONG&gt;Format&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="77"&gt;
&lt;P&gt;&lt;STRONG&gt;Informat&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="86"&gt;
&lt;P&gt;&lt;STRONG&gt;Label&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="60"&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="86"&gt;
&lt;P&gt;birth_date&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="65"&gt;
&lt;P&gt;Char&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;25&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="69"&gt;
&lt;P&gt;$25.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="77"&gt;
&lt;P&gt;$25.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="86"&gt;
&lt;P&gt;birth_date&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.GCC3" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 13 Jun 2023 16:32:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format/m-p/880472#M39067</guid>
      <dc:creator>femiajumobi1</dc:creator>
      <dc:date>2023-06-13T16:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format/m-p/880473#M39068</link>
      <description>&lt;P&gt;Variable birth_date is a character variable.&amp;nbsp; Dates in SAS &lt;EM&gt;must&lt;/EM&gt; be numeric. You have to create a numeric variable with that value and then format the numeric variable. In this case, the values like 21658 and 31193 may be recognizable by SAS as dates, or they may have come over from Excel in which case &lt;A href="https://support.sas.com/resources/papers/proceedings/proceedings/sugi29/068-29.pdf" target="_self"&gt;additional manipulation&lt;/A&gt; is needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    num_birth_date=input(birth_date,12.);
    format num_birth_date mmddyy10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Side issue: if at all possible, avoid storing dates as characters. Store them in numeric SAS variables, in a form that SAS will recognize, which is the number of days since 01JAN1960, formatted however you want.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 16:47:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format/m-p/880473#M39068</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-13T16:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format/m-p/880475#M39070</link>
      <description>Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;</description>
      <pubDate>Tue, 13 Jun 2023 16:42:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format/m-p/880475#M39070</guid>
      <dc:creator>femiajumobi1</dc:creator>
      <dc:date>2023-06-13T16:42:23Z</dc:date>
    </item>
  </channel>
</rss>

