<?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: How to create leading zeros in a macro? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-leading-zeros-in-a-macro/m-p/123618#M25372</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like CATX is treating the number like a number.&amp;nbsp; You don't need CATX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;405 %let number=5;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;406 %let dvar=%sysfunc(today());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;407 %PUT NOTE: %sysfunc(putN(&amp;amp;number,z2))_%SYSFUNC(Intnx(qtr, &amp;amp;dvar, 0, end), DDMMYYP10.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: 05_30.06.2012&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 May 2012 17:22:41 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2012-05-22T17:22:41Z</dc:date>
    <item>
      <title>How to create leading zeros in a macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-leading-zeros-in-a-macro/m-p/123614#M25368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In a macro I am using the code&lt;BR /&gt;------------------------------&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;%SYSFUNC&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;(catx(_,&amp;amp;number ,&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;%SYSFUNC&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;(Intnx(qtr, &amp;amp;dvar, &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;0&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;, end), &lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;DDMMYYP10.&lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-GB" style="font-family: arial,helvetica,sans-serif; background: white; color: #575757; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;-----------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-GB" style="font-family: arial,helvetica,sans-serif; background: white; color: #575757; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;to create the output&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-GB" style="font-family: arial,helvetica,sans-serif; background: white; color: #575757; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;-----------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-GB" style="font-family: arial,helvetica,sans-serif; background: white; color: #575757; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;5_30.06.2013&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-GB" style="font-family: arial,helvetica,sans-serif; background: white; color: #575757; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;-----------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-GB" style="font-family: arial,helvetica,sans-serif; background: white; color: #575757; font-size: 10pt; mso-fareast-language: DE; mso-ansi-language: EN-GB;"&gt;How can I create a dynamic leading zero?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2012 15:39:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-leading-zeros-in-a-macro/m-p/123614#M25368</guid>
      <dc:creator>sfmeier</dc:creator>
      <dc:date>2012-05-22T15:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create leading zeros in a macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-leading-zeros-in-a-macro/m-p/123615#M25369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try replacing &amp;amp;number with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%sysfunc(putn(&amp;amp;number, z2))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Messy, but it should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This assumes that &amp;amp;number is always less than 100, and you only want a leading zero when &amp;amp;number &amp;lt; 10.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2012 16:47:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-leading-zeros-in-a-macro/m-p/123615#M25369</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-05-22T16:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create leading zeros in a macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-leading-zeros-in-a-macro/m-p/123616#M25370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried exactly that, but it does not work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2012 16:51:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-leading-zeros-in-a-macro/m-p/123616#M25370</guid>
      <dc:creator>sfmeier</dc:creator>
      <dc:date>2012-05-22T16:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create leading zeros in a macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-leading-zeros-in-a-macro/m-p/123617#M25371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, you actually made me test my code.&amp;nbsp; It does work for me.&amp;nbsp; There are subtle parts of the syntax, such as PUTN instead of PUT, and no period at the end of the format name.&amp;nbsp; Can you post what you coded, and the results?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what worked:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let n=5;&lt;/P&gt;&lt;P&gt;%let newn = %sysfunc(putn(&amp;amp;n, z2));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2012 16:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-leading-zeros-in-a-macro/m-p/123617#M25371</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-05-22T16:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to create leading zeros in a macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-leading-zeros-in-a-macro/m-p/123618#M25372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like CATX is treating the number like a number.&amp;nbsp; You don't need CATX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;405 %let number=5;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;406 %let dvar=%sysfunc(today());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;407 %PUT NOTE: %sysfunc(putN(&amp;amp;number,z2))_%SYSFUNC(Intnx(qtr, &amp;amp;dvar, 0, end), DDMMYYP10.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: 05_30.06.2012&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2012 17:22:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-leading-zeros-in-a-macro/m-p/123618#M25372</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2012-05-22T17:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to create leading zeros in a macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-leading-zeros-in-a-macro/m-p/123619#M25373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, cool, thx! It works perfectly without catx... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 13:28:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-leading-zeros-in-a-macro/m-p/123619#M25373</guid>
      <dc:creator>sfmeier</dc:creator>
      <dc:date>2012-05-23T13:28:55Z</dc:date>
    </item>
  </channel>
</rss>

