<?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: Looking for a date format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858531#M339220</link>
    <description>&lt;P&gt;You can use following format to get date in 20230213&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;yymmdd8.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is one simple example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
	format dt yymmddn8.;
	dt=today();
put dt=;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;output:&lt;/P&gt;
&lt;PRE&gt;dt=20230213&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Feb 2023 16:43:37 GMT</pubDate>
    <dc:creator>MayurJadhav</dc:creator>
    <dc:date>2023-02-13T16:43:37Z</dc:date>
    <item>
      <title>Looking for a date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858524#M339214</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know please a date format for this presetation of date :&amp;nbsp;20230213&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you !&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2023 16:30:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858524#M339214</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2023-02-13T16:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858525#M339215</link>
      <description>&lt;P&gt;YYMMDDN8.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p0iptsg6780kzfn1k5f0b8s7k7dq.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p0iptsg6780kzfn1k5f0b8s7k7dq.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know please a date format for this presetation of date :&amp;nbsp;20230213&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you !&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2023 16:34:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858525#M339215</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-02-13T16:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858528#M339217</link>
      <description>&lt;P&gt;Sorry, I did not specify, I would like to get it as macro variable.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2023 16:40:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858528#M339217</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2023-02-13T16:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858530#M339219</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Sorry, I did not specify, I would like to get it as macro variable.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You need to provide more detail. Attempting to do some mind reading, maybe this is what you're looking for:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let current_date = %sysfunc(today(), yymmddn8.);
%put &amp;amp;current_date.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Feb 2023 16:41:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858530#M339219</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-02-13T16:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858531#M339220</link>
      <description>&lt;P&gt;You can use following format to get date in 20230213&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;yymmdd8.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is one simple example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
	format dt yymmddn8.;
	dt=today();
put dt=;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;output:&lt;/P&gt;
&lt;PRE&gt;dt=20230213&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2023 16:43:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858531#M339220</guid>
      <dc:creator>MayurJadhav</dc:creator>
      <dc:date>2023-02-13T16:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858533#M339221</link>
      <description>Thank you !</description>
      <pubDate>Mon, 13 Feb 2023 16:46:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858533#M339221</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2023-02-13T16:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858540#M339222</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Sorry, I did not specify, I would like to get it as macro variable.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;HOW do you expect to use that macro variable?&lt;/P&gt;
&lt;P&gt;Quite often formatting a date into a value other than the native value is a poor choice as you can't use the text of a macro variable containing 20130213 to match the value of an actual date variable in a SAS data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A recent example of using a formatted macro variable date that fails because of the formatting: &lt;A href="https://communities.sas.com/t5/SAS-Programming/Intck-does-not-give-the-desired-output/m-p/858470#M339187" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Intck-does-not-give-the-desired-output/m-p/858470#M339187&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2023 18:29:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858540#M339222</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-02-13T18:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858541#M339223</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Sorry, I did not specify, I would like to get it as macro variable.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_self"&gt;Maxim 28&lt;/A&gt;: Macro variables should not be formatted. If you are going to perform arithmetic or Boolean logic on a macro variable, unformatted is best. The one exception: if you are going to use the macro variable in a label, title or filename, then it probably should be formatted.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2023 17:50:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-a-date-format/m-p/858541#M339223</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-13T17:50:12Z</dc:date>
    </item>
  </channel>
</rss>

