<?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: converting date YYYY-MM to YYYY_DD in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-to-YYYY-DD/m-p/792485#M253919</link>
    <description>&lt;P&gt;See if you can use this as a template&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format; 
  picture dtfmt (default = 30)
    other = '%Y_%0m' (datatype=date)
  ;
run;

%let dt = %sysfunc(today(), dtfmt.);
%put &amp;amp;dt.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 26 Jan 2022 14:32:17 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2022-01-26T14:32:17Z</dc:date>
    <item>
      <title>converting date YYYY-MM to YYYY_DD</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-to-YYYY-DD/m-p/792476#M253912</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need date format to YYYY_DD.&lt;/P&gt;&lt;P&gt;So far I was able to get the date format in YYYY-DD by using following code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;/*yymmd7. format - YYYY-DD*/
%let today2 = %sysfunc(today(),yymmd7.);
%put &amp;amp;today2.;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Result:&amp;nbsp;2022-01&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result: 2022_01&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2022 14:15:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-to-YYYY-DD/m-p/792476#M253912</guid>
      <dc:creator>dht115</dc:creator>
      <dc:date>2022-01-26T14:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: converting date YYYY-MM to YYYY_DD</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-to-YYYY-DD/m-p/792482#M253916</link>
      <description>&lt;P&gt;You would have to create a custom format using the PICTURE command in PROC FORMAT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/proc/p1717ykol58oijn13lw9rs30lhn0.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/proc/p1717ykol58oijn13lw9rs30lhn0.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2022 14:26:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-to-YYYY-DD/m-p/792482#M253916</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-26T14:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: converting date YYYY-MM to YYYY_DD</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-to-YYYY-DD/m-p/792485#M253919</link>
      <description>&lt;P&gt;See if you can use this as a template&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format; 
  picture dtfmt (default = 30)
    other = '%Y_%0m' (datatype=date)
  ;
run;

%let dt = %sysfunc(today(), dtfmt.);
%put &amp;amp;dt.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Jan 2022 14:32:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-to-YYYY-DD/m-p/792485#M253919</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-01-26T14:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: converting date YYYY-MM to YYYY_DD</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-to-YYYY-DD/m-p/792507#M253928</link>
      <description>&lt;P&gt;I assume by YYYY_DD you mean year_month&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code below uses the NLDATE function to build the string your are after. When you have nested DATA Step functions, each function needs its own %SYSFUNC. The %NRSTR macro function avoids warning messages.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*yymmd7. format - YYYY-DD*/
%let today2 = %sysfunc(nldate(%sysfunc(today()),%nrstr(%Y_%m)));
%put &amp;amp;today2.;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Jan 2022 15:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-to-YYYY-DD/m-p/792507#M253928</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2022-01-26T15:42:14Z</dc:date>
    </item>
  </channel>
</rss>

