<?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 Symput limitation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Symput-limitation/m-p/108077#M22503</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope to seek if my understanding is correct that there is a limitation on the symput function when storing numeric values coming from a txt/csv file. Please see the code below and the outcomes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options symbolgen mlogic mprint;&lt;/P&gt;&lt;P&gt;data hash;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile "z:\desktop\hash.txt";&lt;/P&gt;&lt;P&gt;&amp;nbsp; input hash :best32.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format hash best32.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set hash;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput('hash',hash);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%put &amp;amp;hash;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Case 1: &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Value on hash.txt &lt;STRONG&gt;1234567890.9&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Macro variable hash: &lt;STRONG&gt;1234567890.9&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Case 2:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Value on hash.txt &lt;STRONG&gt;1234567890.91&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Macro variable hash: &lt;STRONG&gt;1234567890.9&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Case 3:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Value on hash.txt &lt;STRONG&gt;1234567890.98&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Macro variable hash: &lt;STRONG&gt;1234567891&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I correct that when it comes to case 3 that even I have read the file with best32. on the dataset it will store &lt;STRONG&gt;1234567890.98&lt;/STRONG&gt; but when I use symput it would still get rounded on the macro variable. For SAS 9.1.3 it seems that it is defaulted to 12. if I do not specify an informat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Milton&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 15 Jun 2013 02:52:33 GMT</pubDate>
    <dc:creator>milts</dc:creator>
    <dc:date>2013-06-15T02:52:33Z</dc:date>
    <item>
      <title>Symput limitation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symput-limitation/m-p/108077#M22503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope to seek if my understanding is correct that there is a limitation on the symput function when storing numeric values coming from a txt/csv file. Please see the code below and the outcomes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options symbolgen mlogic mprint;&lt;/P&gt;&lt;P&gt;data hash;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile "z:\desktop\hash.txt";&lt;/P&gt;&lt;P&gt;&amp;nbsp; input hash :best32.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format hash best32.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set hash;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput('hash',hash);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%put &amp;amp;hash;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Case 1: &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Value on hash.txt &lt;STRONG&gt;1234567890.9&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Macro variable hash: &lt;STRONG&gt;1234567890.9&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Case 2:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Value on hash.txt &lt;STRONG&gt;1234567890.91&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Macro variable hash: &lt;STRONG&gt;1234567890.9&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Case 3:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Value on hash.txt &lt;STRONG&gt;1234567890.98&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Macro variable hash: &lt;STRONG&gt;1234567891&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I correct that when it comes to case 3 that even I have read the file with best32. on the dataset it will store &lt;STRONG&gt;1234567890.98&lt;/STRONG&gt; but when I use symput it would still get rounded on the macro variable. For SAS 9.1.3 it seems that it is defaulted to 12. if I do not specify an informat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Milton&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Jun 2013 02:52:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symput-limitation/m-p/108077#M22503</guid>
      <dc:creator>milts</dc:creator>
      <dc:date>2013-06-15T02:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Symput limitation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symput-limitation/m-p/108078#M22504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;This phenomenon has nothing to do with "call symput", or should I say it is not specific to "call symput", rather, it happens during automatic numeric-character conversion, such as &lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: medium; background-color: #ffffff;"&gt;concatenation&lt;/SPAN&gt; functions among others. SAS will then use BEST12 to do the conversion, and it is one digit shy in your case (the decimal point takes one), that is why the first one has no change, the second one rounded down and the third one rounded up. &lt;/P&gt;&lt;P&gt;To avoid this from happening, you need to tell SAS which format to use, and by doing so, you need to convert numeric to character proactively.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data _null_;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; set hash;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; call symput('hash',&lt;STRONG&gt;put(hash,best13.)&lt;/STRONG&gt;);&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;You may still have the doubt that you have already give them the format best32., well, yes, but that is only for how they are displayed, not for how they are converted, the bottom line is that regardless the format, the numbers stored in SAS stay the same.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;HTH,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Jun 2013 03:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symput-limitation/m-p/108078#M22504</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-06-15T03:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Symput limitation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symput-limitation/m-p/108079#M22505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the explanation Haikuo!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Jun 2013 03:49:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symput-limitation/m-p/108079#M22505</guid>
      <dc:creator>milts</dc:creator>
      <dc:date>2013-06-15T03:49:04Z</dc:date>
    </item>
  </channel>
</rss>

