<?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 zero-pad a char-formatted number that is greater than 16 digits? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-zero-pad-a-char-formatted-number-that-is-greater-than-16/m-p/683722#M207118</link>
    <description>&lt;P&gt;This link has several methods for a shorter string and a "less than" length requirement.&lt;/P&gt;
&lt;P&gt;Should have somethings that are easy enough to make work with longer strings.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/convert-character-value-quot-1X11-quot-to-quot-000001X11-quot/m-p/683437#M207009" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/convert-character-value-quot-1X11-quot-to-quot-000001X11-quot/m-p/683437#M207009&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Sep 2020 17:40:48 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-09-14T17:40:48Z</dc:date>
    <item>
      <title>How to zero-pad a char-formatted number that is greater than 16 digits?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-zero-pad-a-char-formatted-number-that-is-greater-than-16/m-p/683712#M207114</link>
      <description>&lt;P&gt;I am trying to left-zero-pad an existing list of character-formatted numbers. The numbers vary from 6 digits to 20 digits. I want to zero-pad them to a length of 25.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem that I am having is that every method I can find to zero-pad involves using input() to change the character-formatted numbers to a number format. Because some of my numbers are greater than 16 digits, I am losing precision when I do that. It rounds up any numbers past the sas-recognized 16 limit.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to concatenate 0's to the left of a character-formatted field (up to 25 chars) while keeping it a character-formatted field??&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 16:39:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-zero-pad-a-char-formatted-number-that-is-greater-than-16/m-p/683712#M207114</guid>
      <dc:creator>Cat_Dreamer</dc:creator>
      <dc:date>2020-09-14T16:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to zero-pad a char-formatted number that is greater than 16 digits?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-zero-pad-a-char-formatted-number-that-is-greater-than-16/m-p/683713#M207115</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;outvar = "0000000000000000000000000";
invar = left(invar); /* removes leading blanks */
substr(outvar,26-length(invar)) = invar;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Sep 2020 16:55:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-zero-pad-a-char-formatted-number-that-is-greater-than-16/m-p/683713#M207115</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-14T16:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to zero-pad a char-formatted number that is greater than 16 digits?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-zero-pad-a-char-formatted-number-that-is-greater-than-16/m-p/683717#M207116</link>
      <description>&lt;P&gt;I don't have time at the moment to write out all the SAS code, but yes, there are ways.&lt;/P&gt;&lt;P&gt;One way, in a data step -&amp;nbsp;&lt;/P&gt;&lt;P&gt;use the LENGTH() function to determine the original length of the character variable, then subtract that length from your total expected digits (fiddle with this, you probably have to add 1 in there). Then use the REPEAT() function to repeat zeroes to that number, and concatenate those zeroes with the original variable to create a new variable using one of the CAT() functions (forget if it's CATS or CATT or CATX). All of those functions can be found explained in the internet documentation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 17:19:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-zero-pad-a-char-formatted-number-that-is-greater-than-16/m-p/683717#M207116</guid>
      <dc:creator>heather_g</dc:creator>
      <dc:date>2020-09-14T17:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to zero-pad a char-formatted number that is greater than 16 digits?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-zero-pad-a-char-formatted-number-that-is-greater-than-16/m-p/683722#M207118</link>
      <description>&lt;P&gt;This link has several methods for a shorter string and a "less than" length requirement.&lt;/P&gt;
&lt;P&gt;Should have somethings that are easy enough to make work with longer strings.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/convert-character-value-quot-1X11-quot-to-quot-000001X11-quot/m-p/683437#M207009" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/convert-character-value-quot-1X11-quot-to-quot-000001X11-quot/m-p/683437#M207009&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 17:40:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-zero-pad-a-char-formatted-number-that-is-greater-than-16/m-p/683722#M207118</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-09-14T17:40:48Z</dc:date>
    </item>
  </channel>
</rss>

