<?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: conversion from decimal to characters in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170362#M44031</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So when you convert INSD_N from numeric to character it is still not matching the character strings in the other table?&lt;/P&gt;&lt;P&gt;If the numbers require less than the full 8 characters when converted from number to character with the PUT() function then they will be RIGHT aligned with the PUT() function result.&amp;nbsp; Usually character variables are LEFT align.&amp;nbsp; Try wrapping the PUT() function inside of a LEFT() function and see if it helps.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;N=5.3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;put(N,8.1) -&amp;gt; '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5.3'&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 04 Oct 2014 16:46:25 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2014-10-04T16:46:25Z</dc:date>
    <item>
      <title>conversion from decimal to characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170351#M44020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I use the command put(INSD_N,8.1) and values in column INSD_N are like-&lt;/P&gt;&lt;P&gt;80&lt;/P&gt;&lt;P&gt;120&lt;/P&gt;&lt;P&gt;1390&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get output as&lt;/P&gt;&lt;P&gt;80.0&lt;/P&gt;&lt;P&gt;120.0&lt;/P&gt;&lt;P&gt;1390.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a command which can give me below result&lt;/P&gt;&lt;P&gt;80.00000&lt;/P&gt;&lt;P&gt;120.0000&lt;/P&gt;&lt;P&gt;1390.000&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 18:28:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170351#M44020</guid>
      <dc:creator>nikhilbajaj</dc:creator>
      <dc:date>2014-10-02T18:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: conversion from decimal to characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170352#M44021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For the example you have given, format 8.5 works&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 18:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170352#M44021</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2014-10-02T18:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: conversion from decimal to characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170353#M44022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;but you get the pesky w.d format too small message.&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;_null_&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; y;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;put&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; y &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;bestx8.5&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;cards&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffc0;"&gt;80&lt;BR /&gt;120&lt;BR /&gt;1390&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;;;;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;80.00000&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;120.0000&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1390.000&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 19:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170353#M44022</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-10-02T19:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: conversion from decimal to characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170354#M44023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to deal with char, you can also use the repeat function for example:&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;y='33.3';&lt;/P&gt;&lt;P&gt;z=length(y);&lt;/P&gt;&lt;P&gt;v=8-z;&lt;/P&gt;&lt;P&gt;x=catt(y,repeat('0',v-1));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 19:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170354#M44023</guid>
      <dc:creator>mohamed_zaki</dc:creator>
      <dc:date>2014-10-02T19:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: conversion from decimal to characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170355#M44024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;none of the solutions are working&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i modified the query - but not getting the expected result for data like '2235042'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select CP_N, &lt;/P&gt;&lt;P&gt;case when INSD_N is not missing&lt;/P&gt;&lt;P&gt;then &lt;/P&gt;&lt;P&gt;put(INSD_N,bestx8.5)&lt;/P&gt;&lt;P&gt;else ' '&lt;/P&gt;&lt;P&gt;end as INSD_N&lt;/P&gt;&lt;P&gt;from CCTRP011_CP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 19:40:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170355#M44024</guid>
      <dc:creator>nikhilbajaj</dc:creator>
      <dc:date>2014-10-02T19:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: conversion from decimal to characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170356#M44025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;data_null_; wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;but you get the pesky w.d format too small message.&lt;/P&gt;

&lt;/PRE&gt;

&lt;/PRE&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt; &lt;/DIV&gt;&lt;P&gt;But if you use BESTX8.5 you get that pesky idea in the back of your head that you shouldn't be using unsupported and undocumented formats ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 19:50:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170356#M44025</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2014-10-02T19:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: conversion from decimal to characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170357#M44026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How this is not working for you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input y;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;80&lt;/P&gt;&lt;P&gt;120&lt;/P&gt;&lt;P&gt;1390&lt;/P&gt;&lt;P&gt;2235042&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;yy=strip(put(y,8.1));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;z= length(yy);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;v=8-z;&lt;/P&gt;&lt;P&gt;x=catt(yy,repeat('0',v-1));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 20:58:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170357#M44026</guid>
      <dc:creator>mohamed_zaki</dc:creator>
      <dc:date>2014-10-02T20:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: conversion from decimal to characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170358#M44027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;D format works almost as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 02:10:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170358#M44027</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-10-03T02:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: conversion from decimal to characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170359#M44028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guys I am not a SAS expert. So some of the suggestions go bouncer for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would appreciate if someone updates my query so that I can understand the exact solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rsubmit;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table TEST_RESULT as&lt;BR /&gt;select CP_N, &lt;BR /&gt;case when INSD_N is not missing&lt;BR /&gt;then put(INSD_N,8.1)&lt;BR /&gt;else ' '&lt;BR /&gt;end as INSD_N&lt;BR /&gt;from CCTRP011_CP&lt;/P&gt;&lt;P&gt;except&lt;/P&gt;&lt;P&gt;select CP_N, INSD_N&lt;BR /&gt;from CSTDM111_CUSTOMER&lt;BR /&gt;where CUST_DIM not in (0,1,2);&lt;BR /&gt;select count(*) from TEST_RESULT;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 20:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170359#M44028</guid>
      <dc:creator>nikhilbajaj</dc:creator>
      <dc:date>2014-10-03T20:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: conversion from decimal to characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170360#M44029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This does not appear to have anything to do with this thread. Post it as a new question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 23:01:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170360#M44029</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-10-03T23:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: conversion from decimal to characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170361#M44030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the same question.&lt;/P&gt;&lt;P&gt;Earlier I had given values. Now I am giving the query.&lt;/P&gt;&lt;P&gt;Because I am not able to apply the solution provided in my query.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Oct 2014 16:20:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170361#M44030</guid>
      <dc:creator>nikhilbajaj</dc:creator>
      <dc:date>2014-10-04T16:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: conversion from decimal to characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170362#M44031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So when you convert INSD_N from numeric to character it is still not matching the character strings in the other table?&lt;/P&gt;&lt;P&gt;If the numbers require less than the full 8 characters when converted from number to character with the PUT() function then they will be RIGHT aligned with the PUT() function result.&amp;nbsp; Usually character variables are LEFT align.&amp;nbsp; Try wrapping the PUT() function inside of a LEFT() function and see if it helps.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;N=5.3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;put(N,8.1) -&amp;gt; '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5.3'&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Oct 2014 16:46:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/conversion-from-decimal-to-characters/m-p/170362#M44031</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-10-04T16:46:25Z</dc:date>
    </item>
  </channel>
</rss>

