<?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: Remove the leading zero after converting from numeric to character? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83969#M24091</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The easiest is rounding up ...&lt;/P&gt;&lt;P&gt;I think it will give more cpu overhead, if your dataset is not too big that is the easiest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Switching back to character is another option.&lt;/P&gt;&lt;P&gt;Is the only difference the leading zero and is this consistent?&lt;/P&gt;&lt;P&gt;Not having the , as seperator or shifting spaces or ..(whatever surprise) ? &lt;/P&gt;&lt;P&gt;Than use the character conversion. Characters are 100%&amp;nbsp; reliable (not having unicode involved).&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Jul 2013 15:25:57 GMT</pubDate>
    <dc:creator>jakarman</dc:creator>
    <dc:date>2013-07-19T15:25:57Z</dc:date>
    <item>
      <title>Remove the leading zero after converting from numeric to character?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83961#M24083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a data set that I need to compare to another dataset.&amp;nbsp; For one of the variables it is numeric on one dataset and character on the other. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I did&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Val_ = trim(left(put(Val, best.))) ; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works correctly and takes numeric value 0.01 and creates a character variable that is 0.01.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My issue is that the other dataset shows this data as .01.&amp;nbsp; How can I remove just the zero? &lt;/P&gt;&lt;P&gt;I have to make sure not to remove the zero if the data is 10.01.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for any help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2013 19:55:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83961#M24083</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2013-07-18T19:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the leading zero after converting from numeric to character?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83962#M24084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not convert the character field to numeric and compare those as numerics?&lt;BR /&gt;All presentation issues emliniated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2013 20:06:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83962#M24084</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2013-07-18T20:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the leading zero after converting from numeric to character?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83963#M24085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;pearl regular expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
input x $;
y=prxchange('s/^0//o',-1,x);
cards;
 0.01
10.01
;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 02:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83963#M24085</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-07-19T02:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the leading zero after converting from numeric to character?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83964#M24086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;KSHARP&amp;nbsp; Can you please recommend a good PERL Regular Expression internet resource? I would like to learn more about this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have researched a few, but thought you might have some insight.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 08:19:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83964#M24086</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2013-07-19T08:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the leading zero after converting from numeric to character?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83965#M24087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;if VAL_ =: '0.' then VAL_ = substr(VAL_,2);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 11:25:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83965#M24087</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-07-19T11:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the leading zero after converting from numeric to character?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83966#M24088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you everyone for your replies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used Jaap's solution and i'm very close to getting it to work.&amp;nbsp; This is what i'm doing now&lt;/P&gt;&lt;P&gt;value_ = input(value, 8.) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only issue i'm having now is that the values look identical but when I do a full join on that variable across the two data sets it get rows back where the values are identical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;/P&gt;&lt;P&gt;create table chk_data&lt;/P&gt;&lt;P&gt;as&lt;/P&gt;&lt;P&gt;select a.value_, b.value&lt;/P&gt;&lt;P&gt;from cVal a full join dVal b on a.value_ = b.value&lt;/P&gt;&lt;P&gt;where a.value_ eq . or b.value eq . &lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should return zero rows if all the data matches up but it is returning rows and when I compare the data visually it's identical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is sas comparing the numeric values behind the scenes differently?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 13:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83966#M24088</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2013-07-19T13:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the leading zero after converting from numeric to character?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83967#M24089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is an interesting unexpected difference popping up. &lt;BR /&gt;The root cause is the nature of floating type involving possible not visible seen precision differences.&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/65053/HTML/default/viewer.htm#n1gv8bfdnhvy9yn1cj8g4di2eqg7.htm" title="http://support.sas.com/documentation/cdl/en/acreldb/65053/HTML/default/viewer.htm#n1gv8bfdnhvy9yn1cj8g4di2eqg7.htm"&gt;SAS/ACCESS(R) 9.4 for Relational Databases: Reference&lt;/A&gt; &lt;/P&gt;&lt;P&gt;It does happen easy by the fractions in whole numbers it is more stable. Having done calculations also something can become slightly different. &lt;BR /&gt;The most easy solution is comparing rounded values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The proc SQL usage is setting the direction of having unique values in a full join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAS however has a compare procedure. &lt;A href="http://support.sas.com/documentation/cdl/en/proc/64787/HTML/default/viewer.htm#n0c1y14wyd3u7yn1dmfcpaejllsn.htm" title="http://support.sas.com/documentation/cdl/en/proc/64787/HTML/default/viewer.htm#n0c1y14wyd3u7yn1dmfcpaejllsn.htm"&gt;Base SAS(R) 9.4 Procedures Guide&lt;/A&gt;&amp;nbsp; Is was thinking this proc would be used (wrong). In this proc the criterion is 0.00001 by default with the method=exact,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the precision part, it was alway something cumbersome.&lt;/P&gt;&lt;P&gt;Within SAS/acces there are DBTYPE and DBSAStype type options to influence something.&lt;BR /&gt;With 9.4 (latest 9.3 updates) the proc DS2 has been added. &lt;A href="http://support.sas.com/documentation/cdl/en/proc/64787/HTML/default/viewer.htm#n08hc15x330v75n1vjw9rzlbhe84.htm" title="http://support.sas.com/documentation/cdl/en/proc/64787/HTML/default/viewer.htm#n08hc15x330v75n1vjw9rzlbhe84.htm"&gt;Base SAS(R) 9.4 Procedures Guide&lt;/A&gt;&amp;nbsp; This one knows better the common used DB types.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the overload on the background off the precision part.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 14:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83967#M24089</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2013-07-19T14:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the leading zero after converting from numeric to character?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83968#M24090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jaap,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WOW.&amp;nbsp; That is a lot of info. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm running on sas 9.2.&amp;nbsp; I have had that issue with the proc compare but not with a full join in a proc sql statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would be the best way to handle this issue? Should I switch back to a character and work with removing the leading zero?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for all your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 14:51:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83968#M24090</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2013-07-19T14:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the leading zero after converting from numeric to character?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83969#M24091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The easiest is rounding up ...&lt;/P&gt;&lt;P&gt;I think it will give more cpu overhead, if your dataset is not too big that is the easiest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Switching back to character is another option.&lt;/P&gt;&lt;P&gt;Is the only difference the leading zero and is this consistent?&lt;/P&gt;&lt;P&gt;Not having the , as seperator or shifting spaces or ..(whatever surprise) ? &lt;/P&gt;&lt;P&gt;Than use the character conversion. Characters are 100%&amp;nbsp; reliable (not having unicode involved).&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 15:25:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83969#M24091</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2013-07-19T15:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the leading zero after converting from numeric to character?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83970#M24092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jaap,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you so much for all of your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm going to switch it back to character and check that the first two characters of the value equal '0.' and if it is I will substr(value,2) so it will exclude the zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again to you and everyone for the help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 15:59:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83970#M24092</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2013-07-19T15:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the leading zero after converting from numeric to character?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83971#M24093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott,&lt;/P&gt;&lt;P&gt;Sorry. I have no idea. All my knowledge&amp;nbsp; about Perl Regular Expression is from SAS documentation -- dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 02:01:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-the-leading-zero-after-converting-from-numeric-to/m-p/83971#M24093</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-07-22T02:01:32Z</dc:date>
    </item>
  </channel>
</rss>

