<?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: format date with underscore in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/format-date-with-underscore/m-p/961604#M374871</link>
    <description>&lt;P&gt;It doesn't exist out-the-box, but you can roll out your own using Proc Format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format; 
   picture dtfmt other = '%m_%D_%Y' (datatype=date);
run;

%let runDate=%sysfunc(putn(%sysfunc(date()), dtfmt.)); 
%put &amp;amp;=runDate.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 11 Mar 2025 20:39:29 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2025-03-11T20:39:29Z</dc:date>
    <item>
      <title>format date with underscore</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-date-with-underscore/m-p/961602#M374870</link>
      <description>&lt;P&gt;&amp;nbsp;%let runDate=%sysfunc(putn(%sysfunc(date()), yymmddn8.)); %put &amp;amp;runDate; I want to format the date like 3_11_2025&lt;/P&gt;</description>
      <pubDate>Tue, 11 Mar 2025 20:20:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-date-with-underscore/m-p/961602#M374870</guid>
      <dc:creator>Smitha9</dc:creator>
      <dc:date>2025-03-11T20:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: format date with underscore</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-date-with-underscore/m-p/961604#M374871</link>
      <description>&lt;P&gt;It doesn't exist out-the-box, but you can roll out your own using Proc Format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format; 
   picture dtfmt other = '%m_%D_%Y' (datatype=date);
run;

%let runDate=%sysfunc(putn(%sysfunc(date()), dtfmt.)); 
%put &amp;amp;=runDate.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Mar 2025 20:39:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-date-with-underscore/m-p/961604#M374871</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2025-03-11T20:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: format date with underscore</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-date-with-underscore/m-p/961611#M374877</link>
      <description>&lt;P&gt;You&amp;nbsp; don't need a FORMAT.&amp;nbsp; Use one of the existing formats and then use TRANSLATE() to replace the delimiters.&lt;/P&gt;
&lt;PRE&gt;1    %let rundate=%sysfunc(date(),yymmddd10.);
2    %put &amp;amp;=rundate;
RUNDATE=2025-03-11
3    %let rundate=%sysfunc(translate(&amp;amp;rundate,_,-));
4    %put &amp;amp;=rundate;
RUNDATE=2025_03_11
&lt;/PRE&gt;
&lt;P&gt;PS Do not make strings with dates in MDY or DMY order.&amp;nbsp; In addition to the risk of confusing half of your audience they will not sort properly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you might run the job more than once a day you could use DATETIME() function and formats instead.&amp;nbsp; For example E8601DT16. will display YMDHM.&lt;/P&gt;
&lt;PRE&gt;1    %let rundate=%sysfunc(translate(%sysfunc(datetime(),e8601dt16.),___,-T:));
2    %put &amp;amp;=rundate;
RUNDATE=2025_03_11_18_48
&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Mar 2025 22:49:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-date-with-underscore/m-p/961611#M374877</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-03-11T22:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: format date with underscore</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-date-with-underscore/m-p/961614#M374878</link>
      <description>&lt;P&gt;Or just simply list them all.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let runDate=%sysfunc(date(),month2.)_%sysfunc(date(),day2.)_%sysfunc(date(),year4.);

%put &amp;amp;=runDate ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;7    %let runDate=%sysfunc(date(),month2.)_%sysfunc(date(),day2.)_%sysfunc(date(),year4.);
8
9    %put &amp;amp;=runDate ;
RUNDATE=3_12_2025

&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Mar 2025 01:29:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-date-with-underscore/m-p/961614#M374878</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-03-12T01:29:55Z</dc:date>
    </item>
  </channel>
</rss>

