<?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: why sas removing zero before a character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/why-sas-removing-zero-before-a-character/m-p/620053#M182135</link>
    <description>&lt;OL&gt;
&lt;LI&gt;this not a proc sql at all, it's a data step&lt;/LI&gt;
&lt;LI&gt;this is not a value, but a key, so keep it in character&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Sun, 26 Jan 2020 08:26:32 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-01-26T08:26:32Z</dc:date>
    <item>
      <title>why sas removing zero before a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-sas-removing-zero-before-a-character/m-p/620044#M182128</link>
      <description>&lt;P&gt;I have a proc sql like this one, the problem is that sas remove the zero before each cust_comp_key for example FR_C_00000242 is transforming to 242 but i want to keep the zeo before 242 ...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;rsubmit;
data ca_m_service_2; 
set ca_m_service;
num_compte = input(substr(CUST_COMP_KEY, 6),Best12.);
run;
endrsubmit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thanks for help&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jan 2020 04:54:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-sas-removing-zero-before-a-character/m-p/620044#M182128</guid>
      <dc:creator>viji154</dc:creator>
      <dc:date>2020-01-26T04:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: why sas removing zero before a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-sas-removing-zero-before-a-character/m-p/620045#M182129</link>
      <description>&lt;DIV class="lia-message-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;I have a proc sql like this one, the problem is that sas remove the zero before each cust_comp_key for example FR_C_00000242 is transforming to 242 but i want to keep the zeo before 242 ... &lt;A href="https://faceforpc.com/" target="_self"&gt;&lt;FONT color="#000000"&gt;faceforpc&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;rsubmit;
data ca_m_service_2; 
set ca_m_service;
num_compte = input(substr(CUST_COMP_KEY, 6),Best12.);
run;
endrsubmit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thanks for help&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems to work but now I need to transformr this vector to numeric, how can I do this ?&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jan 2020 04:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-sas-removing-zero-before-a-character/m-p/620045#M182129</guid>
      <dc:creator>viji154</dc:creator>
      <dc:date>2020-01-26T04:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: why sas removing zero before a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-sas-removing-zero-before-a-character/m-p/620048#M182131</link>
      <description>&lt;P&gt;Adding a format will change the appearance to what you want:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input cust_comp_key :$13.;
datalines;
FR_C_00000242
;
run;

data want;
set have;
num_compte = input(substr(cust_comp_key,6),best.);
format num_compte z12.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 26 Jan 2020 05:09:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-sas-removing-zero-before-a-character/m-p/620048#M182131</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2020-01-26T05:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: why sas removing zero before a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-sas-removing-zero-before-a-character/m-p/620049#M182132</link>
      <description>&lt;P&gt;Numbers don't have leading zeros, or they have an infinite number of them, since the meaning of 0242 and 242 is the same number.&lt;/P&gt;
&lt;P&gt;If you want to keep the leading zeros then keep the value as a character variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;customer_id = substr(CUST_COMP_KEY,6);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want SAS to DISPLAY a number with a fixed number of digits by showing leading zeros then attached the Z format to it.&amp;nbsp; But you cannot ask it just add one leading zero so that 15 become 015 and 242 becomes 0242. You can only say display, for example, 8 digits.&amp;nbsp; Then when the value is less than 10,000,000 there will be enough leading zeros to display exactly 8 digits.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;customer_id_as_number = input(substr(CUST_COMP_KEY,6),8.);
format customer_id_as_number z8.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 26 Jan 2020 05:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-sas-removing-zero-before-a-character/m-p/620049#M182132</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-26T05:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: why sas removing zero before a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-sas-removing-zero-before-a-character/m-p/620053#M182135</link>
      <description>&lt;OL&gt;
&lt;LI&gt;this not a proc sql at all, it's a data step&lt;/LI&gt;
&lt;LI&gt;this is not a value, but a key, so keep it in character&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Sun, 26 Jan 2020 08:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-sas-removing-zero-before-a-character/m-p/620053#M182135</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-26T08:26:32Z</dc:date>
    </item>
  </channel>
</rss>

