<?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 Format Leading Zeros in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137035#M36929</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you! I'll never understand when Z works and when it doesn't.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Sep 2014 18:04:19 GMT</pubDate>
    <dc:creator>TashaBee</dc:creator>
    <dc:date>2014-09-09T18:04:19Z</dc:date>
    <item>
      <title>How to Format Leading Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137026#M36920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am working on a snippet where I am formatting SSN. In the past, the Z format worked, but it has not worked lately. I tried using picture (for example, picture ssfmt other = '999999999';), but that hasn't worked as well. I am getting an error that states that the format was not found or could not be loaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;picture ssfmt low-high = '999999999';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ID starts of with a character of 20 length. Then I do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;length newid $9.;&lt;/P&gt;&lt;P&gt;newid =idnumber;&lt;/P&gt;&lt;P&gt;newssn = input(newid, ssfmt.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any pointers?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 14:41:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137026#M36920</guid>
      <dc:creator>TashaBee</dc:creator>
      <dc:date>2014-09-09T14:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to Format Leading Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137027#M36921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why no use the SSN format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;_null_&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ssn=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;000090201&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;put&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; ssn &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;ssn.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;000&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;09&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;0201&lt;/STRONG&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 14:45:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137027#M36921</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-09-09T14:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to Format Leading Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137028#M36922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply, but I am getting the error that the format could not be found or loaded.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 14:56:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137028#M36922</guid>
      <dc:creator>TashaBee</dc:creator>
      <dc:date>2014-09-09T14:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to Format Leading Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137029#M36923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible that your variable is character, but in previous applications it was numeric?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 15:00:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137029#M36923</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-09-09T15:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to Format Leading Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137030#M36924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is a character variable what I am using.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 15:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137030#M36924</guid>
      <dc:creator>TashaBee</dc:creator>
      <dc:date>2014-09-09T15:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to Format Leading Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137031#M36925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it is character then perhaps you should read it (input function) into a numeric variable then apply SSN format to the new variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 15:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137031#M36925</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-09-09T15:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Format Leading Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137032#M36926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As you noticed, SAS complains when you try to apply a numeric format (such as ssn. or z9.) to a character variable.&amp;nbsp; Since your variable is defined as 20 characters long, you can replace it with the proper value using the tools that data_null_ suggested:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;idnumber = put(input(left(idnumber),9.), ssn.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to keep IDNUMBER as is, you could always assign this value to a new variable instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 17:24:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137032#M36926</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-09-09T17:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to Format Leading Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137033#M36927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you! That worked and I did a compress to get rid of the hyphens.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 17:45:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137033#M36927</guid>
      <dc:creator>TashaBee</dc:creator>
      <dc:date>2014-09-09T17:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to Format Leading Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137034#M36928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, if you don't want the hyphens it's just slightly different:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;idnumber = put(input(left(idnumber),9.), z9.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 17:49:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137034#M36928</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-09-09T17:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to Format Leading Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137035#M36929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you! I'll never understand when Z works and when it doesn't.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 18:04:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137035#M36929</guid>
      <dc:creator>TashaBee</dc:creator>
      <dc:date>2014-09-09T18:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to Format Leading Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137036#M36930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works when the data is NUMERIC.&amp;nbsp; Does not work for character data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Sep 2014 20:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Format-Leading-Zeros/m-p/137036#M36930</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-09-09T20:30:36Z</dc:date>
    </item>
  </channel>
</rss>

