<?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 SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763715#M241857</link>
    <description>&lt;P&gt;I go it, YYYMMDDSD10.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Aug 2021 20:36:08 GMT</pubDate>
    <dc:creator>JHE</dc:creator>
    <dc:date>2021-08-24T20:36:08Z</dc:date>
    <item>
      <title>Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763259#M241706</link>
      <description>&lt;P&gt;Date for example: 3/21/2021,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;want to convert to 2021/3/21,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there as good way to do instead convert to Str&amp;nbsp; ...?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does SAS has date format as yyyy/mm/dd ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 14:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763259#M241706</guid>
      <dc:creator>JHE</dc:creator>
      <dc:date>2021-08-23T14:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763261#M241707</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/128890"&gt;@JHE&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Date for example: 3/21/2021,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;want to convert to 2021/3/21,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there as good way to do instead convert to Str&amp;nbsp; ...?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does SAS has date format as yyyy/mm/dd ?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;just assign a different format to this variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format variablename yymmdds10.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in a DATA step or PROC&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 15:00:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763261#M241707</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-23T15:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763263#M241708</link>
      <description>&lt;P&gt;SAS has a LOT of date, time and datetime formats plus you can roll your own. However you want to start with an actual SAS date value.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&lt;/A&gt; has a PDF with much information about dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you already have date value then you just assign the format you want with a Format statement such as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Format datevariable yymmdd10.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of the very nice things about formats is that you can specify the format to use just about anytime you need to and are not stuck with a default set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example for creating a date value and then displaying it in Proc print with different formats:&lt;/P&gt;
&lt;PRE&gt;data example;
   date ='21Mar2021'd;
   format date date9.;
run;
/* this uses whatever the default format may be*/
Proc print data=example noobs;
run;

Proc print data=example;
   format date yymmdd10.;
run;

Proc print data=example;
   format date worddate.;
run;

/* Julian date: year and then day of the year*/
Proc print data=example;
   format date juldate.;
run;&lt;/PRE&gt;
&lt;P&gt;I suggest keeping track of &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/leforinforref/n0p2fmevfgj470n17h4k9f27qjag.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/leforinforref/n0p2fmevfgj470n17h4k9f27qjag.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;so you can look up the SAS formats and informats by type easily.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 14:59:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763263#M241708</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-23T14:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763712#M241856</link>
      <description>&lt;P&gt;thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But need result as: YYYY/MM/DD, such as&amp;nbsp;2021/02/23&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 20:20:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763712#M241856</guid>
      <dc:creator>JHE</dc:creator>
      <dc:date>2021-08-24T20:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763715#M241857</link>
      <description>&lt;P&gt;I go it, YYYMMDDSD10.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 20:36:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763715#M241857</guid>
      <dc:creator>JHE</dc:creator>
      <dc:date>2021-08-24T20:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763723#M241858</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; There is a way in the yymmdd format to specify what type of separator you want. Here's an example that shows the BIRTHDAY variable being read into a SAS numeric variable that represents a date. Then the year the person turns 21 and the year they turn 65 are calculated using the INTNX function to create 2 new variables. The date variables are each displayed using a different format for display:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1629837873719.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62965i1A14A5EDE658B367/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1629837873719.png" alt="Cynthia_sas_0-1629837873719.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 20:47:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763723#M241858</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-08-24T20:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763725#M241859</link>
      <description>&lt;P&gt;&lt;STRONG&gt;WHY DON'T YOU READ THE DOCUMENTATION???&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/leforinforref/p0iptsg6780kzfn1k5f0b8s7k7dq.htm" target="_blank" rel="noopener"&gt;YYMMDDxw. Format&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 20:48:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/763725#M241859</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-08-24T20:48:29Z</dc:date>
    </item>
  </channel>
</rss>

