<?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: Remove leading zeroes from character string in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Remove-leading-zeroes-from-character-string/m-p/653436#M78823</link>
    <description>&lt;P&gt;"Can't get this to work" is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the &amp;lt;&amp;gt; to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&lt;/A&gt;... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the &amp;lt;&amp;gt; icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jun 2020 20:45:39 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-06-04T20:45:39Z</dc:date>
    <item>
      <title>Remove leading zeroes from character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-leading-zeroes-from-character-string/m-p/653433#M78820</link>
      <description>&lt;P&gt;I have a character variable&amp;nbsp;that&amp;nbsp;is an ID&amp;nbsp;number&amp;nbsp;with leading zeroes than force it to be 10 digits--e.g., 0000012345. I would like to remove one leading zero to make it have a width of 9. The below line accomplished what I had intended, but a code reviewer said that I should not use 1* to convert from character to numeric and suggested that I use an input statement.&lt;/P&gt;
&lt;PRE&gt;ID=put(1*ID, z9.);&lt;/PRE&gt;
&lt;P&gt;I have tried a few things (see below, for example), but can't get this to work.&lt;/P&gt;
&lt;PRE&gt;ID=input(ID, $10.);
format ID z9.;&lt;/PRE&gt;
&lt;P&gt;Any ideas?&lt;/P&gt;
&lt;P&gt;I fear the solution is something very obvious, but I am new to SAS and am very much struggling with this.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2020 20:34:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-leading-zeroes-from-character-string/m-p/653433#M78820</guid>
      <dc:creator>raivester</dc:creator>
      <dc:date>2020-06-04T20:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Remove leading zeroes from character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-leading-zeroes-from-character-string/m-p/653434#M78821</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; want_id=put(input(id,10.),z9.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jun 2020 20:43:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-leading-zeroes-from-character-string/m-p/653434#M78821</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-06-04T20:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: Remove leading zeroes from character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-leading-zeroes-from-character-string/m-p/653436#M78823</link>
      <description>&lt;P&gt;"Can't get this to work" is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the &amp;lt;&amp;gt; to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&lt;/A&gt;... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the &amp;lt;&amp;gt; icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2020 20:45:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-leading-zeroes-from-character-string/m-p/653436#M78823</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-04T20:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Remove leading zeroes from character string</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-leading-zeroes-from-character-string/m-p/653559#M78830</link>
      <description>&lt;PRE&gt;data have;
id='0000012345';
want_id=prxchange('s/^0//',1,strip(id));
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Jun 2020 11:21:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-leading-zeroes-from-character-string/m-p/653559#M78830</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-06-05T11:21:40Z</dc:date>
    </item>
  </channel>
</rss>

