<?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: Convert Number to String in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-Number-to-String/m-p/676189#M203851</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/329634"&gt;@RDS2020&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regardless of the conversion details you should be aware of the limitations of how SAS stores numeric values: See&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=lrcon&amp;amp;docsetTarget=p0ji1unv6thm0dn1gp4t01a1u0g6.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p1ikmedbli0rz2n1de001ryz895o" target="_self"&gt;Maximum Integer Size&lt;/A&gt;&amp;nbsp;and try&amp;nbsp;&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;no_var = 1234567891011121&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;or&amp;nbsp;&lt;FONT face="courier new,courier"&gt;no_var = 1234567891011121&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;47&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;to see what can happen to the least significant digit(s). Unless your "16-18 digit long" numbers meet certain numeric conditions, you would need to resort to the BIGINT data type, which is available in the &lt;A href="https://documentation.sas.com/?docsetId=ds2ref&amp;amp;docsetTarget=p01duniqmrmhs1n1lbs4te5kl9pd.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#n1gx3px54rue34n17klnr7v77ipl" target="_blank" rel="noopener"&gt;DS2 language&lt;/A&gt; and in &lt;A href="https://documentation.sas.com/?docsetId=fedsqlref&amp;amp;docsetTarget=p1uao2myrymg6bn1c5sd610r87cg.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;FedSQL&lt;/A&gt;, but not in the DATA step, or better store them in character variables in the first place.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Aug 2020 14:57:11 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2020-08-12T14:57:11Z</dc:date>
    <item>
      <title>Convert Number to String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Number-to-String/m-p/676160#M203836</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;How can i convert my 16-18 digit long number to simple string&amp;nbsp; just like it happens with TO_CHAR in sql.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using below to convert number to character:, the purpose to use $20. is to make sure&amp;nbsp; if my digits are&amp;nbsp; more than 16 digits still it get converted to String-. Basically I am trying to use SAS version of TO_CHAR in SQL. STRIP is used to remove trailing and leading spaces which might get added to the chr_var as a result of PUT function&lt;/P&gt;&lt;P&gt;data new;&lt;BR /&gt;no_var = 12345678910111214;&lt;BR /&gt;chr_var = strip(put(no_var, $20.));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Issue is it runs fine in the seclusion but when added to the actual script it gives below error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Character format $ in PUT function requires a character argument.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate the help.&lt;/P&gt;&lt;P&gt;RDS&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 13:55:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Number-to-String/m-p/676160#M203836</guid>
      <dc:creator>RDS2020</dc:creator>
      <dc:date>2020-08-12T13:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Number to String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Number-to-String/m-p/676162#M203838</link>
      <description>&lt;P&gt;&lt;EM&gt;Editors note:&amp;nbsp; Thanks for the correct response here,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;.&amp;nbsp; I am also pasting the important reminder from&amp;nbsp; &amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp; below&amp;nbsp; due to the size of the numeric value that is to be printed.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;chr_var = strip(put(no_var, 20.));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;EM&gt;Regardless of the conversion details you should be aware of the limitations of how SAS stores numeric values: See&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=lrcon&amp;amp;docsetTarget=p0ji1unv6thm0dn1gp4t01a1u0g6.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p1ikmedbli0rz2n1de001ryz895o" target="_self" rel="nofollow noopener noreferrer"&gt;Maximum Integer Size&lt;/A&gt;&amp;nbsp;and try&amp;nbsp;&lt;FONT face="courier new,courier"&gt;no_var = 1234567891011121&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;or&amp;nbsp;&lt;FONT face="courier new,courier"&gt;no_var = 1234567891011121&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;47&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;to see what can happen to the least significant digit(s). Unless your "16-18 digit long" numbers meet certain numeric conditions, you would need to resort to the BIGINT data type, which is available in the&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=ds2ref&amp;amp;docsetTarget=p01duniqmrmhs1n1lbs4te5kl9pd.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#n1gx3px54rue34n17klnr7v77ipl" target="_blank" rel="noopener nofollow noreferrer"&gt;DS2 language&lt;/A&gt;&amp;nbsp;and in&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=fedsqlref&amp;amp;docsetTarget=p1uao2myrymg6bn1c5sd610r87cg.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener nofollow noreferrer"&gt;FedSQL&lt;/A&gt;, but not in the DATA step, or better store them in character variables in the first place.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 22:01:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Number-to-String/m-p/676162#M203838</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2023-12-08T22:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Number to String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Number-to-String/m-p/676189#M203851</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/329634"&gt;@RDS2020&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regardless of the conversion details you should be aware of the limitations of how SAS stores numeric values: See&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=lrcon&amp;amp;docsetTarget=p0ji1unv6thm0dn1gp4t01a1u0g6.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p1ikmedbli0rz2n1de001ryz895o" target="_self"&gt;Maximum Integer Size&lt;/A&gt;&amp;nbsp;and try&amp;nbsp;&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;no_var = 1234567891011121&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;or&amp;nbsp;&lt;FONT face="courier new,courier"&gt;no_var = 1234567891011121&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;47&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;to see what can happen to the least significant digit(s). Unless your "16-18 digit long" numbers meet certain numeric conditions, you would need to resort to the BIGINT data type, which is available in the &lt;A href="https://documentation.sas.com/?docsetId=ds2ref&amp;amp;docsetTarget=p01duniqmrmhs1n1lbs4te5kl9pd.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#n1gx3px54rue34n17klnr7v77ipl" target="_blank" rel="noopener"&gt;DS2 language&lt;/A&gt; and in &lt;A href="https://documentation.sas.com/?docsetId=fedsqlref&amp;amp;docsetTarget=p1uao2myrymg6bn1c5sd610r87cg.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;FedSQL&lt;/A&gt;, but not in the DATA step, or better store them in character variables in the first place.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 14:57:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Number-to-String/m-p/676189#M203851</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-08-12T14:57:11Z</dc:date>
    </item>
  </channel>
</rss>

