<?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 add leading zero to a subset of data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-leading-zero-to-a-subset-of-data/m-p/722039#M223846</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a character ID variable like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;001&lt;/P&gt;&lt;P&gt;002&lt;/P&gt;&lt;P&gt;003&lt;/P&gt;&lt;P&gt;L8982&lt;/P&gt;&lt;P&gt;L8983&lt;/P&gt;&lt;P&gt;L8984&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to add a leading zero only to those IDs whose first number is also number. In other words, I want&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;0001&lt;/P&gt;&lt;P&gt;0002&lt;/P&gt;&lt;P&gt;0003&lt;/P&gt;&lt;P&gt;L8982&lt;/P&gt;&lt;P&gt;L8983&lt;/P&gt;&lt;P&gt;L8984&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone write a sample code for me to help me solve this problem?&lt;/P&gt;&lt;P&gt;Any help is appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Feb 2021 03:56:47 GMT</pubDate>
    <dc:creator>zjppdozen</dc:creator>
    <dc:date>2021-02-26T03:56:47Z</dc:date>
    <item>
      <title>How to add leading zero to a subset of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-leading-zero-to-a-subset-of-data/m-p/722039#M223846</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a character ID variable like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;001&lt;/P&gt;&lt;P&gt;002&lt;/P&gt;&lt;P&gt;003&lt;/P&gt;&lt;P&gt;L8982&lt;/P&gt;&lt;P&gt;L8983&lt;/P&gt;&lt;P&gt;L8984&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to add a leading zero only to those IDs whose first number is also number. In other words, I want&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;0001&lt;/P&gt;&lt;P&gt;0002&lt;/P&gt;&lt;P&gt;0003&lt;/P&gt;&lt;P&gt;L8982&lt;/P&gt;&lt;P&gt;L8983&lt;/P&gt;&lt;P&gt;L8984&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone write a sample code for me to help me solve this problem?&lt;/P&gt;&lt;P&gt;Any help is appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 03:56:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-leading-zero-to-a-subset-of-data/m-p/722039#M223846</guid>
      <dc:creator>zjppdozen</dc:creator>
      <dc:date>2021-02-26T03:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to add leading zero to a subset of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-leading-zero-to-a-subset-of-data/m-p/722041#M223847</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if input(ID,?? 32.) and length(ID)=3 then ID='0'||ID;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 04:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-leading-zero-to-a-subset-of-data/m-p/722041#M223847</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-02-26T04:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to add leading zero to a subset of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-leading-zero-to-a-subset-of-data/m-p/722227#M223912</link>
      <description>&lt;P&gt;This code works very well! Thank you very much!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 19:12:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-leading-zero-to-a-subset-of-data/m-p/722227#M223912</guid>
      <dc:creator>zjppdozen</dc:creator>
      <dc:date>2021-02-26T19:12:57Z</dc:date>
    </item>
  </channel>
</rss>

