<?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: Correcting numeric to character error in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Correcting-numeric-to-character-error/m-p/127796#M34947</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; I ended up using the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; loans2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; ln_no $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;10&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; loans;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; Account__ = &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;.&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; ln_no = &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;else&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; ln_no = put(input(Account__,??&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;10.&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal;"&gt;z10.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The program ran ok and I get output.&amp;nbsp; In a few cases I get an error message due to very large account numbers.&amp;nbsp; See example.&amp;nbsp; Was I also supposed to use&lt;/P&gt;&lt;P style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black;"&gt;ln_no = compress(ln_no,'.');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If so, would that account for account numbers that are extremely large.&amp;nbsp; How would I plug that part of the code into the one I show here?&amp;nbsp; The report runs on a unix server.&amp;nbsp; Since I get output and the program does not stop, I may still be ok but wanted to get rid of the error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: Invalid numeric data, ACCOUNT__='21,500,002,156,297,200' , at line 95 column 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 May 2013 19:33:06 GMT</pubDate>
    <dc:creator>omega1983</dc:creator>
    <dc:date>2013-05-02T19:33:06Z</dc:date>
    <item>
      <title>Correcting numeric to character error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Correcting-numeric-to-character-error/m-p/127794#M34945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;data loans2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;16246&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +&amp;nbsp; length ln_no $10;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;16247&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;16248&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +&amp;nbsp; set loans;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;16249&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +&amp;nbsp; if Account__ = . then ln_no = ' ';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;16250&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +&amp;nbsp; else ln_no = put(Account__,z10.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ____&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 48&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;ERROR 48-59: The format $Z was not found or could not be loaded.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This error occurs using the account number. This is an attempt to treat the Account_ as a character.&amp;nbsp; Not sure why I am getting the error&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 May 2013 15:17:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Correcting-numeric-to-character-error/m-p/127794#M34945</guid>
      <dc:creator>omega1983</dc:creator>
      <dc:date>2013-05-02T15:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: Correcting numeric to character error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Correcting-numeric-to-character-error/m-p/127795#M34946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ACCOUNT__ must be already defined in the dataset LOANS as a character variable.&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;&lt;SPAN style="color: #000000; font-style: inherit; background-color: #ffffff; font-family: 'Courier New';"&gt;ln_no = put(input(Account__,??10.),z10.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black;"&gt;ln_no = compress(ln_no,'.');&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 May 2013 15:38:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Correcting-numeric-to-character-error/m-p/127795#M34946</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-05-02T15:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Correcting numeric to character error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Correcting-numeric-to-character-error/m-p/127796#M34947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; I ended up using the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; loans2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; ln_no $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;10&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; loans;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; Account__ = &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;.&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; ln_no = &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;else&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; ln_no = put(input(Account__,??&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;10.&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal;"&gt;z10.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The program ran ok and I get output.&amp;nbsp; In a few cases I get an error message due to very large account numbers.&amp;nbsp; See example.&amp;nbsp; Was I also supposed to use&lt;/P&gt;&lt;P style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black;"&gt;ln_no = compress(ln_no,'.');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If so, would that account for account numbers that are extremely large.&amp;nbsp; How would I plug that part of the code into the one I show here?&amp;nbsp; The report runs on a unix server.&amp;nbsp; Since I get output and the program does not stop, I may still be ok but wanted to get rid of the error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: Invalid numeric data, ACCOUNT__='21,500,002,156,297,200' , at line 95 column 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 May 2013 19:33:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Correcting-numeric-to-character-error/m-p/127796#M34947</guid>
      <dc:creator>omega1983</dc:creator>
      <dc:date>2013-05-02T19:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Correcting numeric to character error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Correcting-numeric-to-character-error/m-p/127797#M34948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error message is from this line expression: &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background-color: white; color: black;"&gt; Account__ = &lt;/SPAN&gt;&lt;STRONG style="font-family: 'Courier New'; color: teal; background-color: white;"&gt;.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'Courier New'; color: teal; background-color: white;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Suppression of that error message is why I reversed your logic.&amp;nbsp; My example will generate the variable LN_NO for all values of account. The ?? in front of the INFORMAT will suppress the error message. The other advantage of doing the PUT() function first is that if LN_NO is not defined in the input dataset then SAS will know to create it as a character variable of length 10 based on the use of Z10. format. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the value in ACCOUNT__ is invalid then the INPUT() function will return missing and the PUT() function should spit it out as a period in position 10. (depending of the setting of the option MISSING).&amp;nbsp; So the COMPRESS() function will convert the period to a space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You might need more complex logic if the variable ACCOUNT__ is longer than $10.&amp;nbsp; Using INPUT(ACCOUNT__,10.) will only read the first 10 characters.&amp;nbsp; So if ACCOUNT__ is twelve digits long it will ignore the last two, so '000000000100' would be converted to 1 instead of 100.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 May 2013 20:41:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Correcting-numeric-to-character-error/m-p/127797#M34948</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-05-02T20:41:53Z</dc:date>
    </item>
  </channel>
</rss>

