<?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: Number Format leading Numbers in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384968#M92020</link>
    <description>&lt;P&gt;Consider using an ATTRIB statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data MIRA_RED_ACCOUNTS_2016;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; attrib mortgage format=z10. ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; input mortgage : 10.;&lt;BR /&gt;cards;&lt;BR /&gt;123&lt;BR /&gt;4567&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I rarely have a data step w/o an attrib. Define the variables for the data step before creating them so your final dataset is exactly as you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Aug 2017 13:50:17 GMT</pubDate>
    <dc:creator>AlanC</dc:creator>
    <dc:date>2017-08-02T13:50:17Z</dc:date>
    <item>
      <title>Number Format leading Numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384955#M92012</link>
      <description>&lt;P&gt;Hi, I am importing an excel spreadhseet with around 5000 mortgage numbers. Some numbers are only 7 numbers in length so for those accounts I need to add a leading zero. The code used below, any idea why I get the error message here please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;17 mortgage=put(_mortgage,z10.);&lt;BR /&gt; ____&lt;BR /&gt; 484&lt;BR /&gt;NOTE 484-185: Format $Z was not found or could not be loaded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CODE WRITTEN BELOW&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data MIRA_RED_ACCOUNTS_2016;&lt;BR /&gt;infile "/opt/sas/data/uk/Personal Folders/Scants/MIRA Red Accounts2016.csv";&lt;BR /&gt;input mortgage : $10.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data mira;&lt;BR /&gt; set WORK.MIRA_RED_ACCOUNTS_2016 (rename=(mortgage=_mortgage));&lt;BR /&gt; mortgage=put(_mortgage,z10.);&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 13:26:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384955#M92012</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2017-08-02T13:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: Number Format leading Numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384958#M92015</link>
      <description>&lt;P&gt;The Z. format only works with numeric fields so you first have to convert it. e.g.:&lt;/P&gt;
&lt;PRE&gt;data MIRA_RED_ACCOUNTS_2016;
  input mortgage : $10.;
  cards;
123
4567
;

data mira;
  set WORK.MIRA_RED_ACCOUNTS_2016 (rename=(mortgage=_mortgage));
  mortgage=put(input(_mortgage,10.),z10.);
run;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 13:32:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384958#M92015</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-08-02T13:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Number Format leading Numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384962#M92017</link>
      <description>&lt;P&gt;You have one dollar sign too many:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;input mortgage : $10.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Get rid of the dollar sign to create MORTGAGE originally as a numeric variable.&amp;nbsp; Your final DATA step will convert it to character.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 13:43:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384962#M92017</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-02T13:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: Number Format leading Numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384963#M92018</link>
      <description>&lt;P&gt;if I remove the $ from&amp;nbsp;input mortgage : $10.; then all I see is a dot for my mortgage?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 13:46:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384963#M92018</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2017-08-02T13:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Number Format leading Numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384968#M92020</link>
      <description>&lt;P&gt;Consider using an ATTRIB statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data MIRA_RED_ACCOUNTS_2016;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; attrib mortgage format=z10. ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; input mortgage : 10.;&lt;BR /&gt;cards;&lt;BR /&gt;123&lt;BR /&gt;4567&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I rarely have a data step w/o an attrib. Define the variables for the data step before creating them so your final dataset is exactly as you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 13:50:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384968#M92020</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2017-08-02T13:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Number Format leading Numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384980#M92025</link>
      <description>&lt;P&gt;If you are getting . for the mortgage values, it indicates that there are other characters (non-numeric) present.&amp;nbsp; To overcome that, leave the $ in place and try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;len = length(mortgage);&lt;/P&gt;
&lt;P&gt;if len &amp;lt; 10 then mortgage = repeat('0', 9-len) || mortgage;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 14:16:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384980#M92025</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-02T14:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Number Format leading Numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384981#M92026</link>
      <description>&lt;P&gt;Given the problem you are confronting It would help if you attach&amp;nbsp;a representative sample dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 14:24:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-Format-leading-Numbers/m-p/384981#M92026</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-08-02T14:24:44Z</dc:date>
    </item>
  </channel>
</rss>

