<?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: Adding leading Zeros to Numeric Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90942#M257334</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using oracle . I change my mind, I will use SAS to accesses the oracle data. But still that conversion bugs me .( Char&amp;nbsp; to Numeric with leading zero&amp;nbsp; ) ....hopefully&amp;nbsp; I will figure out something.. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Oct 2012 04:35:03 GMT</pubDate>
    <dc:creator>Reid</dc:creator>
    <dc:date>2012-10-11T04:35:03Z</dc:date>
    <item>
      <title>Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90932#M257324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H2&gt;Hi All,&lt;/H2&gt;&lt;H2&gt;&lt;/H2&gt;&lt;H2&gt;Hers is the situation, where need to leading to the numeric variable ;&lt;/H2&gt;&lt;H2&gt;&lt;/H2&gt;&lt;H2&gt;Example : ( data is in oracle sever )&lt;/H2&gt;&lt;H2&gt;cust.id ( Numeric )&lt;/H2&gt;&lt;H2&gt;---------------&lt;/H2&gt;&lt;H2&gt;374747830939&lt;/H2&gt;&lt;H2&gt;&lt;/H2&gt;&lt;H2&gt;and&amp;nbsp; Need to convert &lt;/H2&gt;&lt;H2&gt;cust.id ( Numeric )&lt;/H2&gt;&lt;H2&gt;---------------&lt;/H2&gt;&lt;H2&gt;000374747830939&lt;/H2&gt;&lt;H2&gt;&lt;/H2&gt;&lt;H2&gt;Thanks in advance ,&lt;/H2&gt;&lt;H2&gt;Rakesh&lt;/H2&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 04:35:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90932#M257324</guid>
      <dc:creator>Reid</dc:creator>
      <dc:date>2012-10-10T04:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90933#M257325</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Easy. &amp;nbsp;This converts the numeric to a formatted character value with leading zeros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
 a=374747830939;
 b=put(a,z15.);
 format a z15.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Ksharp&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/34372"&gt;@RichardinOz&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If joining&amp;nbsp;two tables with a 'key' variable and the key varible in one table is numeric and in another it's character.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can join 2 tables in SAS using keys as you describe quite easily.&amp;nbsp; If table A has numeric key and B has char values then use the INPUT function to convert the char to a number for comparison.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc SQL ;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Create table want as
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select A.---
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp;&amp;nbsp; B.---
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From A A
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp;&amp;nbsp; B B
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Where a.key1 = input(B.key2, Best32.)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;
Quit ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you want to do the join in Oracle you can &lt;A href="https://communities.sas.com/t5/General-SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90938#M27603" target="_self"&gt;use Tom's code&lt;/A&gt; to achieve the same result, using a character comparison.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 21:12:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90933#M257325</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-12-03T21:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90934#M257326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ksharp showed you how to convert a numeric variable in SAS to a string with leading zeros stored in a character variable. Is this what you need?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...or is this something which needs to be done in Oracle (eg. to join with a Varchar having such leading zeros) ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...or do you need a numeric variable in SAS which prints with leading zeros?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 09:59:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90934#M257326</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-10-10T09:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90935#M257327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ksharp,&lt;/P&gt;&lt;P&gt; thanks for replay , I need the&amp;nbsp; "b" varible be numeric. your code gives in char varible after chnaging it.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 14:05:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90935#M257327</guid>
      <dc:creator>Reid</dc:creator>
      <dc:date>2012-10-10T14:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90936#M257328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@ patrick,&lt;/P&gt;&lt;P&gt; Actually , I am joing two tables with 'key' varible. The key varible in one table it is numeric and in another it's charecter. So i need to convert char to numeric, During the converiosn i shoud not remove leading zeros. So i need help in adding leading zero's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your hlep,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 14:12:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90936#M257328</guid>
      <dc:creator>Reid</dc:creator>
      <dc:date>2012-10-10T14:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90937#M257329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sry.. I need to do it in TOAD. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 14:13:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90937#M257329</guid>
      <dc:creator>Reid</dc:creator>
      <dc:date>2012-10-10T14:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90938#M257330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is easier to convert the character variable into numbers. Only issue would be if you had values in the character variable that are different, but convert to the same number. ('012' and '12' for example)&amp;nbsp; But in that case you will have problems with your merge anyway.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* Convert character variable to numeric ;&lt;/P&gt;&lt;P&gt;select * from a,b where a.id = input(b.id,15.)&lt;/P&gt;&lt;P&gt;* Convert numeric variable to character ;&lt;/P&gt;&lt;P&gt;select * from a,b where put(a.id,z15.) = b.id ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using TOAD then you need to know the SQL syntax for the database you are pulling from to be able to write the code to convert.&amp;nbsp; What type of database are you pulling the data from?&amp;nbsp; Oracle, SQL Server, Teradata, ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why are you using TOAD?&amp;nbsp; Why not just query the database using SAS?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 16:05:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90938#M257330</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-10-10T16:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90939#M257331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;is it possible to add leading "0"s to a numeric variable in SAS and still have it as numeric?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 20:48:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90939#M257331</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2012-10-10T20:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90940#M257332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The interal storage of numbers doesn't change but for any time you want to SEE leading zeroes use the Zw.d format.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 21:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90940#M257332</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-10-10T21:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90941#M257333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can add as many leading zeros to a number as you want and it will not change the value.&lt;/P&gt;&lt;P&gt;0 x 10**100 is still 0.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 23:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90941#M257333</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-10-10T23:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90942#M257334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using oracle . I change my mind, I will use SAS to accesses the oracle data. But still that conversion bugs me .( Char&amp;nbsp; to Numeric with leading zero&amp;nbsp; ) ....hopefully&amp;nbsp; I will figure out something.. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 04:35:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90942#M257334</guid>
      <dc:creator>Reid</dc:creator>
      <dc:date>2012-10-11T04:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90943#M257335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i think so , i will defiantly post&amp;nbsp; it. If i come up with come up some&amp;nbsp; thing...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 04:36:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90943#M257335</guid>
      <dc:creator>Reid</dc:creator>
      <dc:date>2012-10-11T04:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90944#M257336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So my A is still numeric variable.&lt;/P&gt;&lt;P&gt;but its internal&amp;nbsp; value is 374747830939 , it looks like&amp;nbsp; 000374747830939 .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 06:15:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90944#M257336</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-10-11T06:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90945#M257337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do the join where your data lives - so do it in Oracle. I was thinking that it shouldn't be too hard to convert character to numeric (or the other way round) in Oracle using either TO_NUMBER() or TO_CHARACTER.&lt;/P&gt;&lt;P&gt;Being an iregular Oracle user I Googled the doc to post the correct syntax - and then look what I found under &lt;A href="http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements002.htm#i55214" title="http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements002.htm#i55214"&gt;Datatype Comparison Rules&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"When comparing a character value with a numeric value, Oracle converts the character data to a numeric value."&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image-thumbnail jive-image" height="574" src="https://communities.sas.com/legacyfs/online/2616_Capture.PNG" width="1193" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 12:00:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90945#M257337</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-10-11T12:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90946#M257338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;but Reid,&lt;/P&gt;&lt;P&gt;why cant you add the "0"s after the conversion?&lt;/P&gt;&lt;P&gt;I dont understand.I dont think you can convert char to num and still be able to manage keeping the leading "0"s without adding them afterwards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 17:29:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90946#M257338</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2012-10-11T17:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90947#M257339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Could you tell me how add after converting Char to Numeric .( in oralce )&lt;/P&gt;&lt;P&gt;I was readiing paper&amp;nbsp; (see below title&amp;nbsp; ), oracel won't save numeric&amp;nbsp; variable value with leading zero. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know your thoughts...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 18pt;"&gt;Using SAS&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt;"&gt;® &lt;/SPAN&gt;&lt;SPAN style="font-size: 18pt;"&gt;with Oracle&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt;"&gt;®&lt;/SPAN&gt;&lt;SPAN style="font-size: 18pt;"&gt;: Writing efficient and accurate SQL &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 20:35:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90947#M257339</guid>
      <dc:creator>Reid</dc:creator>
      <dc:date>2012-10-11T20:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90948#M257340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry,i was talking SAS not Oracle.Dont know how you could do it in Oracle&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 21:47:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90948#M257340</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2012-10-11T21:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90949#M257341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot add leading zeros to a number.&amp;nbsp; It just does not make sense either mathematical or in computer science.&lt;/P&gt;&lt;P&gt;What is your actual problem?&amp;nbsp; Are you having trouble querying the data?&amp;nbsp; Or matching records between two tables (datasets) ?&lt;/P&gt;&lt;P&gt;Can you show the example data?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With SAS you can add a format to display a number with leading zeros.&amp;nbsp; You can even have the format permanently attached to the variable in the definition of the dataset so that the default for displaying the number will include the leading zeros.&amp;nbsp; I do not think you can do the same in Oracle.&amp;nbsp; You can use a function call to convert a number to a character string and specify that leading zeros are printed.&amp;nbsp; Is that what you want to know how to do?&amp;nbsp; To do that in Oracle use to TO_CHAR function with a format.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Courier; color: blue; background: white;"&gt;to_char(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Courier; color: maroon; background: white;"&gt;12&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Courier; color: blue; background: white;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Courier; color: maroon; background: white;"&gt;349&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Courier; color: blue; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Courier; color: red; background: white;"&gt;'099999.99'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Courier; color: blue; background: white;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: Courier; color: black;"&gt;returns "000012.35"&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 22:07:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90949#M257341</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-10-11T22:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90950#M257342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt; x='0001451';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data t1;&lt;/P&gt;&lt;P&gt; set test;&lt;/P&gt;&lt;P&gt; format y z7.;&lt;/P&gt;&lt;P&gt; y=x*1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2013 15:31:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90950#M257342</guid>
      <dc:creator>kellysmith</dc:creator>
      <dc:date>2013-01-04T15:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Adding leading Zeros to Numeric Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90951#M257343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt; x='0001451';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data t1;&lt;/P&gt;&lt;P&gt; set test;&lt;/P&gt;&lt;P&gt; format y z7.;&lt;/P&gt;&lt;P&gt; y=x*1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After running your code, this code will keep the leading zeros after converting the varible from char to numeric.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2013 15:33:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-leading-Zeros-to-Numeric-Variable/m-p/90951#M257343</guid>
      <dc:creator>kellysmith</dc:creator>
      <dc:date>2013-01-04T15:33:21Z</dc:date>
    </item>
  </channel>
</rss>

