<?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 How to get rid of padded zeros when converting from Character to numeric in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-rid-of-padded-zeros-when-converting-from-Character-to/m-p/195266#M48898</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have character field&amp;nbsp; Var1 = "00001234" I convert the above value from character to numeric as follows: data a; format Var1_new 11.; Var1 = "00001234"; Var1_New = Var1 *1; run; Above example does convert to numeric but keeps Zeros. Also I want to know how to get rid of padded zeros in case of Character Value. So If&amp;nbsp; have Var1 = "00001234".&amp;nbsp; I want Var1 = "1234" Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Mar 2015 17:30:32 GMT</pubDate>
    <dc:creator>pp2014</dc:creator>
    <dc:date>2015-03-05T17:30:32Z</dc:date>
    <item>
      <title>How to get rid of padded zeros when converting from Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-rid-of-padded-zeros-when-converting-from-Character-to/m-p/195266#M48898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have character field&amp;nbsp; Var1 = "00001234" I convert the above value from character to numeric as follows: data a; format Var1_new 11.; Var1 = "00001234"; Var1_New = Var1 *1; run; Above example does convert to numeric but keeps Zeros. Also I want to know how to get rid of padded zeros in case of Character Value. So If&amp;nbsp; have Var1 = "00001234".&amp;nbsp; I want Var1 = "1234" Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 17:30:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-rid-of-padded-zeros-when-converting-from-Character-to/m-p/195266#M48898</guid>
      <dc:creator>pp2014</dc:creator>
      <dc:date>2015-03-05T17:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of padded zeros when converting from Character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-rid-of-padded-zeros-when-converting-from-Character-to/m-p/195267#M48899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PLEASE format your code when posting.&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;pp2014 wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Above example does convert to numeric but keeps Zeros.&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It doesn't on my system, and you're using implicit conversion which will leave a note in your log.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp; Obs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var1_new&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="line-height: 1.5em; font-size: 12pt;"&gt;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1234&amp;nbsp;&amp;nbsp;&amp;nbsp; 00001234&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="line-height: 1.5em; font-size: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;&lt;SPAN style="line-height: 1.5em;"&gt;Use explicit conversion instead, via the input &lt;/SPAN&gt;&lt;SPAN style="line-height: 24px;"&gt;function&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5em;"&gt;&amp;nbsp; To remove leading zeros but retain as a character variable you can either use regular expressions to remove leading zero's or use put/input.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="line-height: 1.5em; font-size: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; a1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;SPAN style="color: #0433ff;"&gt;format&lt;/SPAN&gt; Var1_new &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;11.&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #942193;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;SPAN style="color: #000000;"&gt;Var1 = &lt;/SPAN&gt;"00001234"&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="font-size: 12pt;"&gt;Var1_New = input(var1, &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;11.&lt;/STRONG&gt;&lt;/SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="font-size: 12pt;"&gt;var1_Char = put(input(var1, &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;11.&lt;/STRONG&gt;&lt;/SPAN&gt;), &lt;SPAN style="color: #009193;"&gt;$11.&lt;/SPAN&gt; -l);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #011993;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #011993;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;print&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0433ff;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;=a1;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #011993;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp; Obs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var1_new&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Char&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;SPAN style="line-height: 1.5em; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1234&amp;nbsp;&amp;nbsp;&amp;nbsp; 00001234&amp;nbsp;&amp;nbsp;&amp;nbsp; 1234&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 17:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-rid-of-padded-zeros-when-converting-from-Character-to/m-p/195267#M48899</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-03-05T17:48:24Z</dc:date>
    </item>
  </channel>
</rss>

