<?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 convert into date format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/convert-into-date-format/m-p/799725#M314480</link>
    <description>&lt;P&gt;How to convert a number into date, say the no is 22625 which I want to show as 11Dec2021, I read the doc but couldnt get it. Thanks.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Mar 2022 03:26:35 GMT</pubDate>
    <dc:creator>HeatherNewton</dc:creator>
    <dc:date>2022-03-03T03:26:35Z</dc:date>
    <item>
      <title>convert into date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-into-date-format/m-p/799725#M314480</link>
      <description>&lt;P&gt;How to convert a number into date, say the no is 22625 which I want to show as 11Dec2021, I read the doc but couldnt get it. Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 03:26:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-into-date-format/m-p/799725#M314480</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-03-03T03:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: convert into date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-into-date-format/m-p/799732#M314486</link>
      <description>&lt;P&gt;I think all you need to do is apply a DATE9. format. If you do this as part of a data step then the format is now the default display format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   x=22625;
   format x date9. ;
run;&lt;/PRE&gt;
&lt;P&gt;You can assign a different format for specific uses:&lt;/P&gt;
&lt;PRE&gt;Title "Default format assigned";
proc print data=example;
run;

Title "Override default format in procedure";
proc print data=example;
   format x yymmdd10.;
run;
title;
&lt;/PRE&gt;
&lt;P&gt;SAS formats are rules for how to display any given value(s). Note that the the name of the format ends in a dot, or would have a dot where decimals would occur. In the following example the number will be displayed with at most 12 characters including a decimal point and 2 decimals, which here forces zeroes after the decimal.&lt;/P&gt;
&lt;PRE&gt;Proc print data=example;
    format x f12.2;
run;&lt;/PRE&gt;
&lt;P&gt;Formats are a very powerful tool in SAS as groups created by formats are used by most analysis, graphing and reporting procedures. So if you have a lot of date values and want to know how many values are in each year you could use Proc freq and a format that only displays years:&lt;/P&gt;
&lt;PRE&gt;Proc freq data=yourdataset;
   tables datevariable;
   format datevariable year4. ;
run;&lt;/PRE&gt;
&lt;P&gt;Or pick a format that only displays year and month to get the count in each calendar month.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you can create your own formats with Proc Format the are very few limits on grouping with formats. Plus a few procedures can use special Multiple label formats so that one format could create things like age group 1 to 18, 1 to 6,7 to 12, 13 to 18, 1 to 3, 4 to 6, 7 to 9, 10 to 13, 10 to 18, for example with a single format. Again only Procs Tabulate, Report, Means and Summary will use these but can be very helpful.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 04:32:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-into-date-format/m-p/799732#M314486</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-03-03T04:32:21Z</dc:date>
    </item>
  </channel>
</rss>

