<?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: Extracting Italian month name from a date variable in SAS macro in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Extracting-Italian-month-name-from-a-date-variable-in-SAS-macro/m-p/968011#M45973</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/422918"&gt;@cepp0&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p12zqzvwx4dv6kn1p9crijxswolk.htm" target="_blank" rel="noopener"&gt;PUTN&lt;/A&gt; instead of PUT with %SYSFUNC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note that you can simplify your code substantially: Assuming an Italian &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/nlsref/n1n9bwctsthuqbn1xgipyw5xwujl.htm" target="_blank" rel="noopener"&gt;LOCALE system option&lt;/A&gt; setting, you can apply the SAS-supplied &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/n0i1i3bp6hb1z8n1jr24b1ydkoh1.htm" target="_blank" rel="noopener"&gt;NLDATEMN&lt;EM&gt;w&lt;/EM&gt;. format&lt;/A&gt;&amp;nbsp;directly to a SAS date value, so you don't need to extract the month number and create your own format for it. The SAS date value, in turn, can be a date literal such as&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;&amp;amp;DATA_PERIO&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;"d&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;So, assuming that you have this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options locale=IT_IT;
%let DATA_PERIO=31Dec2024;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you can simply define&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;%let MESE_TEXT = %sysfunc(&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;putn&lt;/STRONG&gt;&lt;/FONT&gt;(&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;&amp;amp;DATA_PERIO&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;"d&lt;/FONT&gt;&lt;/STRONG&gt;, &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;nldatemn&lt;/STRONG&gt;&lt;/FONT&gt;));&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;to obtain the value &lt;FONT face="courier new,courier"&gt;Dicembre&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or, alternatively:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;%let MESE_TEXT = %sysfunc(&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;int&lt;/STRONG&gt;&lt;/FONT&gt;(&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;&amp;amp;DATA_PERIO&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;"d&lt;/FONT&gt;&lt;/STRONG&gt;), &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;nldatemn&lt;/FONT&gt;&lt;/STRONG&gt;);&lt;/FONT&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 03 Jun 2025 08:48:29 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2025-06-03T08:48:29Z</dc:date>
    <item>
      <title>Extracting Italian month name from a date variable in SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Extracting-Italian-month-name-from-a-date-variable-in-SAS-macro/m-p/968009#M45972</link>
      <description>&lt;P&gt;I'm working with a SAS program that needs to extract the month name in Italian (e.g., "Dicembre") from a macro variable containing a date (`&amp;amp;DATA_PERIO = 31Dec2024`). I need this to dynamically build Excel filenames.&amp;nbsp;I've tried several approaches but encounter errors:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;/* Creating format for month names in Italian */
PROC FORMAT;
  VALUE mese_ita
    1 = 'Gennaio' 2 = 'Febbraio' 3 = 'Marzo' 4 = 'Aprile' 5 = 'Maggio' 6 = 'Giugno'
    7 = 'Luglio' 8 = 'Agosto' 9 = 'Settembre' 10 = 'Ottobre' 11 = 'Novembre' 12 = 'Dicembre';
RUN;

/* Attempt 1: Using inputn and PUT */
%LET DATA_PERIO_NUM = %sysfunc(inputn(&amp;amp;DATA_PERIO, date9.));
%LET MESE_NUM = %sysfunc(MONTH(&amp;amp;DATA_PERIO_NUM));
%LET MESE_TEXT = %sysfunc(PUT(&amp;amp;MESE_NUM, mese_ita.));&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ERROR: The PUT function referenced in the %SYSFUNC or %QSYSFUNC macro function is not found.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I need to obtain a macro variable `&amp;amp;MESE_TEXT` containing the Italian month name to use in this pattern:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let filename = Analisi Crediti &amp;amp;MESE_TEXT &amp;amp;ANNO&amp;amp;file_suffix..xlsm;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Could someone suggest the correct approach to extract the Italian month name from a date variable within a macro context? What are the appropriate functions to use with %sysfunc for this operation?&lt;/P&gt;&lt;P&gt;Thank you in advance for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jun 2025 08:08:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Extracting-Italian-month-name-from-a-date-variable-in-SAS-macro/m-p/968009#M45972</guid>
      <dc:creator>cepp0</dc:creator>
      <dc:date>2025-06-03T08:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Italian month name from a date variable in SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Extracting-Italian-month-name-from-a-date-variable-in-SAS-macro/m-p/968011#M45973</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/422918"&gt;@cepp0&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p12zqzvwx4dv6kn1p9crijxswolk.htm" target="_blank" rel="noopener"&gt;PUTN&lt;/A&gt; instead of PUT with %SYSFUNC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note that you can simplify your code substantially: Assuming an Italian &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/nlsref/n1n9bwctsthuqbn1xgipyw5xwujl.htm" target="_blank" rel="noopener"&gt;LOCALE system option&lt;/A&gt; setting, you can apply the SAS-supplied &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/n0i1i3bp6hb1z8n1jr24b1ydkoh1.htm" target="_blank" rel="noopener"&gt;NLDATEMN&lt;EM&gt;w&lt;/EM&gt;. format&lt;/A&gt;&amp;nbsp;directly to a SAS date value, so you don't need to extract the month number and create your own format for it. The SAS date value, in turn, can be a date literal such as&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;&amp;amp;DATA_PERIO&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;"d&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;So, assuming that you have this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options locale=IT_IT;
%let DATA_PERIO=31Dec2024;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you can simply define&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;%let MESE_TEXT = %sysfunc(&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;putn&lt;/STRONG&gt;&lt;/FONT&gt;(&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;&amp;amp;DATA_PERIO&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;"d&lt;/FONT&gt;&lt;/STRONG&gt;, &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;nldatemn&lt;/STRONG&gt;&lt;/FONT&gt;));&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;to obtain the value &lt;FONT face="courier new,courier"&gt;Dicembre&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or, alternatively:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;%let MESE_TEXT = %sysfunc(&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;int&lt;/STRONG&gt;&lt;/FONT&gt;(&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;&amp;amp;DATA_PERIO&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;"d&lt;/FONT&gt;&lt;/STRONG&gt;), &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;nldatemn&lt;/FONT&gt;&lt;/STRONG&gt;);&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Jun 2025 08:48:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Extracting-Italian-month-name-from-a-date-variable-in-SAS-macro/m-p/968011#M45973</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2025-06-03T08:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Italian month name from a date variable in SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Extracting-Italian-month-name-from-a-date-variable-in-SAS-macro/m-p/968037#M45975</link>
      <description>&lt;P&gt;And if you want Italian even if that is not your Locale setting there is an explicit format for that, ITADFMN.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a simple way to check what DATE formats exist.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data date_format;
  set sashelp.vformat;
  where fmttype='F' and fmtinfo(fmtname,'cat')='date';
  where also fmtname ^=: '$';
  length min def max $100;
  min=putn(date(),cats(fmtname,minw));
  def=putn(date(),cats(fmtname,defw));
  max=putn(date(),cats(fmtname,maxw));
  keep fmtname min def max;
run;
proc print width=min;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1748970838305.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/107541iCB9D3660BDE45DD9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Tom_0-1748970838305.png" alt="Tom_0-1748970838305.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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jun 2025 17:15:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Extracting-Italian-month-name-from-a-date-variable-in-SAS-macro/m-p/968037#M45975</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-06-03T17:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Italian month name from a date variable in SAS macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Extracting-Italian-month-name-from-a-date-variable-in-SAS-macro/m-p/968064#M45976</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, for the reminder.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, I would say using&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;%let MESE_TEXT = %sysfunc(&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;putn&lt;/STRONG&gt;&lt;/FONT&gt;(&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;&amp;amp;DATA_PERIO&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;"d&lt;/FONT&gt;&lt;/STRONG&gt;, &lt;FONT color="#993366"&gt;&lt;STRONG&gt;itadfmn&lt;/STRONG&gt;&lt;/FONT&gt;));&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;is even better than my suggested &lt;FONT face="courier new,courier"&gt;nldatemn&lt;/FONT&gt;, as it doesn't rely on the LOCALE setting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It just seems that SAS discourages us from using those language-specific format names. First, they are a bit hard to find in the documentation: They are not contained in the "&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p0z62k899n6a7wn1r5in6q5253v1.htm" target="_blank" rel="noopener"&gt;Dictionary of Formats&lt;/A&gt;" and not mentioned in the "&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/nlsref/p0qenieob5jr4mn1dcthvv8822vo.htm" target="_blank" rel="noopener"&gt;Dictionary of Formats for NLS&lt;/A&gt;" either. A few occurrences (including &lt;FONT face="courier new,courier"&gt;itadfmn&lt;/FONT&gt;) can be found in the "Example" sections of the documentation of the EUR... formats such as &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/nlsref/p145pxsliwoaogn146kcyceye2q2.htm" target="_blank" rel="noopener"&gt;EURDFMN&lt;EM&gt;w&lt;/EM&gt;.&lt;/A&gt;&amp;nbsp;in the appendix "&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/nlsref/p1bri99k1w01e3n1xjc689qf14hv.htm" target="_blank" rel="noopener"&gt;Additional NLS Language Elements&lt;/A&gt;". But the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/nlsref/n1ta9hosby6dq3n16s5wgc6908po.htm" target="_blank" rel="noopener"&gt;introductory section of that appendix&lt;/A&gt; says:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;The following EUR language elements have been replaced with NL language elements. The EUR elements are supported in SAS 9.3 &lt;EM&gt;&lt;FONT color="#000000"&gt;[sic!]&lt;/FONT&gt;&lt;/EM&gt;, but SAS recommends that you use the NL elements.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 07:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Extracting-Italian-month-name-from-a-date-variable-in-SAS-macro/m-p/968064#M45976</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2025-06-04T07:59:16Z</dc:date>
    </item>
  </channel>
</rss>

