<?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: Keeping leading 0 while converting from character to numeric in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457547#M70132</link>
    <description>Z8.2</description>
    <pubDate>Wed, 25 Apr 2018 22:12:26 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-04-25T22:12:26Z</dc:date>
    <item>
      <title>Keeping leading 0 while converting from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457546#M70131</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I use&amp;nbsp;SAS enterprise. While importing a comma delimited excel -csv file into SAS, I want to convert the first column (A) from character filed to numeric field without losing the leading zeros.&lt;/P&gt;
&lt;P&gt;I selected w.d and bestw.d formats from the drop-down menu but the leading zeros were not retained.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Is there any other format i can select to serve this purpose.&lt;/LI&gt;
&lt;LI&gt;I also want to get rid of the single quotation marks from the values under the columns.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Any ideas/ suggestions/help are greatly appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am attaching the sample of the file here..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="column A.JPG" style="width: 413px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20151i1E7DBA123EC9CBE8/image-size/large?v=v2&amp;amp;px=999" role="button" title="column A.JPG" alt="column A.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 22:03:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457546#M70131</guid>
      <dc:creator>Ashwini_uci</dc:creator>
      <dc:date>2018-04-25T22:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping leading 0 while converting from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457547#M70132</link>
      <description>Z8.2</description>
      <pubDate>Wed, 25 Apr 2018 22:12:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457547#M70132</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-25T22:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping leading 0 while converting from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457553#M70135</link>
      <description>&lt;P&gt;Thank you Reeza.&lt;/P&gt;
&lt;P&gt;It is actually showing me all blanks after conversion because the values carry the single quotation marks. Is there any way i can get rid of those before conversion from character to numeric?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 22:29:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457553#M70135</guid>
      <dc:creator>Ashwini_uci</dc:creator>
      <dc:date>2018-04-25T22:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping leading 0 while converting from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457554#M70136</link>
      <description>&lt;P&gt;It may help to describe, preferably with code, how you imported the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 22:36:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457554#M70136</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-25T22:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping leading 0 while converting from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457559#M70138</link>
      <description>&lt;P&gt;Did you check the list of functions available in SAS?&lt;/P&gt;
&lt;P&gt;They're listed here for the record:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n01f5qrjoh9h4hn1olbdpb5pr2td.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n01f5qrjoh9h4hn1olbdpb5pr2td.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You probably want to look at COMPRESS() or TRANSLATE().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1890"&gt;@Ashwini_uci&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thank you Reeza.&lt;/P&gt;
&lt;P&gt;It is actually showing me all blanks after conversion because the values carry the single quotation marks. Is there any way i can get rid of those before conversion from character to numeric?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 22:41:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457559#M70138</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-25T22:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping leading 0 while converting from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457560#M70139</link>
      <description>&lt;P&gt;I am using SAS enterprise and I am using the &lt;U&gt;&lt;FONT color="#FF0000"&gt;import data option from File menu&lt;/FONT&gt;&lt;/U&gt; and following the prompts.&lt;/P&gt;
&lt;P&gt;The data is being imported fine. But when I try to convert from character to numeric, it shows all misisng values and I think it is because of the &lt;U&gt;&lt;FONT color="#FF0000"&gt;quotation marks&lt;/FONT&gt;&lt;/U&gt; around the values. I am not sure how i can get rid of the quotation marks. They disappear when I choose the numeric option during the import process. In that case the quotation marks go away but the values end up missing the leading zeros as well.&lt;/P&gt;
&lt;P&gt;Hope this description helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 22:42:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457560#M70139</guid>
      <dc:creator>Ashwini_uci</dc:creator>
      <dc:date>2018-04-25T22:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping leading 0 while converting from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457563#M70140</link>
      <description>&lt;P&gt;If the data was imported 'fine' it wouldn't have quotation marks. That's not a typical way to store data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1890"&gt;@Ashwini_uci&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I am using SAS enterprise and I am using the &lt;U&gt;&lt;FONT color="#FF0000"&gt;import data option from File menu&lt;/FONT&gt;&lt;/U&gt; and following the prompts.&lt;/P&gt;
&lt;P&gt;The data is being imported fine. But when I try to convert from character to numeric, it shows all misisng values and I think it is because of the &lt;U&gt;&lt;FONT color="#FF0000"&gt;quotation marks&lt;/FONT&gt;&lt;/U&gt; around the values. I am not sure how i can get rid of the quotation marks. They disappear when I choose the numeric option during the import process. In that case the quotation marks go away but the values end up missing the leading zeros as well.&lt;/P&gt;
&lt;P&gt;Hope this description helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 22:48:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457563#M70140</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-25T22:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping leading 0 while converting from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457573#M70143</link>
      <description>&lt;P&gt;In passing, you mentioned the right solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Import the field as numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then apply a format:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;format a z5.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can't store the variable with a leading zero, because numbers are not stored as a string of characters.&amp;nbsp; But the format lets you print the numeric value with a leading zero.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 23:14:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457573#M70143</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-25T23:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping leading 0 while converting from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457597#M70146</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;!&lt;/P&gt;
&lt;P&gt;That is what I was hoping to achieve, but the drop-down list does not know z5 format. So I ended up importing the data as is. Then i used the compress fucntion to get rid of the quotations marks first followed by converting the format to z5. It finally worked.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 02:51:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457597#M70146</guid>
      <dc:creator>Ashwini_uci</dc:creator>
      <dc:date>2018-04-26T02:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping leading 0 while converting from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457598#M70147</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;!&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Compress function worked fine in getting rid of the quotations marks. Then I was able to convert the format to z5. It all finally worked.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 02:53:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Keeping-leading-0-while-converting-from-character-to-numeric/m-p/457598#M70147</guid>
      <dc:creator>Ashwini_uci</dc:creator>
      <dc:date>2018-04-26T02:53:03Z</dc:date>
    </item>
  </channel>
</rss>

