<?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: ERRORS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801267#M315335</link>
    <description>&lt;P&gt;We don't understand either. Using the&amp;nbsp;&lt;EM&gt;character&lt;/EM&gt; function SUBSTR on&amp;nbsp;&lt;EM&gt;numeric&lt;/EM&gt; values is simply a VERY BAD IDEA.&lt;/P&gt;
&lt;P&gt;Are you sure that the variable is numeric in your original dataset (use PROC CONTENTS)?&lt;/P&gt;</description>
    <pubDate>Thu, 10 Mar 2022 09:40:28 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-03-10T09:40:28Z</dc:date>
    <item>
      <title>ERRORS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801215#M315301</link>
      <description>&lt;PRE&gt;data lemon;
  input accountno1 accountno2 accountno3 ;
datalines;
1234567890   123456789012    12345678901234
run;


data test;
set lemon;
result1=compress(substr(accountno1,1,8)||put((input(substr(accountno1,9,1),1.)-1),5.)||substr(accountno1,10,7)||put((input(substr(accountno1,17,1),1.)+1),5.)||substr(accountno1,18,2)," ");
result2=compress(substr(accountno2,1,8)||put((input(substr(accountno1,9,1),1.)-1),5.)||substr(accountno1,10,7)||put((input(substr(accountno1,17,1),1.)+1),5.)||substr(accountno1,18,2)," ");
result3=compress(substr(accountno3,1,8)||put((input(substr(accountno1,9,1),1.)-1),5.)||substr(accountno1,10,7)||put((input(substr(accountno1,17,1),1.)+1),5.)||substr(accountno1,18,2)," ");
output out=test;
run;

proc print data=test;
run;&lt;/PRE&gt;
&lt;DIV class="sasSource"&gt;GETTING BELOW ERRORS, PLEASE KINDLY TAKE A LOOK FOR ME, THANKS.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;78 result1=compress(substr(accountno1,1,8)||put((input(substr(accountno1,9,1),1.)-1),5.)||substr(accountno1,10,7)||put((inpu&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;78 ! t(substr(accountno1,17,1),1.)+1),5.)||substr(accountno1,18,2)," ");&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;79 result2=compress(substr(accountno2,1,8)||put((input(substr(accountno1,9,1),1.)-1),5.)||substr(accountno1,10,7)||put((inpu&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;79 ! t(substr(accountno1,17,1),1.)+1),5.)||substr(accountno1,18,2)," ");&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;80 result3=compress(substr(accountno3,1,8)||put((input(substr(accountno1,9,1),1.)-1),5.)||substr(accountno1,10,7)||put((inpu&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;80 ! t(substr(accountno1,17,1),1.)+1),5.)||substr(accountno1,18,2)," ");&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;81 output out=test;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;_&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;79&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;___&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;455&lt;/DIV&gt;
&lt;DIV id="sasLogError1_1646885020286" class="sasError"&gt;ERROR 79-322: Expecting a RC.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="sasLogError2_1646885020286" class="sasError"&gt;ERROR 455-185: Data set was not specified on the DATA statement.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;82 run;&lt;/DIV&gt;</description>
      <pubDate>Thu, 10 Mar 2022 04:10:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801215#M315301</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-03-10T04:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: ERRORS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801216#M315302</link>
      <description>&lt;P&gt;The out= is not required for the output statement in the data step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;output test;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Mar 2022 04:37:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801216#M315302</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2022-03-10T04:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: ERRORS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801217#M315303</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Again, if your question has been answered, please mark the answer as&amp;nbsp;"&lt;SPAN&gt;Accepted Solution"&lt;/SPAN&gt; for the benefit of later viewers.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please review the following guidelines.&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/Getting-Started/Community-etiquette-The-do-s-and-don-ts-of-the-SAS-Support/ta-p/224384" target="_blank"&gt;https://communities.sas.com/t5/Getting-Started/Community-etiquette-The-do-s-and-don-ts-of-the-SAS-Support/ta-p/224384&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2022 04:47:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801217#M315303</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2022-03-10T04:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: ERRORS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801226#M315307</link>
      <description>&lt;P&gt;I get curious about who/why/how someone managed to screw up values in the middle of an account number that need to be adjusted that way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post your log in a text box. You will see that the error:&lt;/P&gt;
&lt;DIV class="sasSource"&gt;81 output out=test;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;_&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;79&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;___&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;455&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;would have the underscore character in two places because of two different types of errors as in this:&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;
&lt;PRE&gt;1    data junk;
2       set sashelp.class;
3       output out=junk;
                  -
                  79
               ---
               455
ERROR 79-322: Expecting a RC.

ERROR 455-185: Data set was not specified on the DATA statement.

4    run;
&lt;/PRE&gt;
The first single underscore associated with the 79-322 error says the = sign is not expected.&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;The second set of 3 undescores is under the word OUT. The Output statement only takes a data set name as an option. That name must be on the DATA statement at the start of the data step. So the codes are telling you that OUT is not acceptable as the name of a data step for output. Coupled they tell you that "Out=" does not belong with OUTPUT.&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;And the OUTPUT statement is not needed in this case.&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;After you fix the OUTPUT statement problem be prepared to deal with many invalid data notes:&lt;BR /&gt;
&lt;PRE&gt;12   data test;
13   set lemon;
14   result1=compress(substr(accountno1,1,8)||put((input(substr(accountno1,9,1),1.)-1),5.)||substr
14 ! (accountno1,10,7)||put((input(substr(accountno1,17,1),1.)+1),5.)||substr(accountno1,18,2),"
14 ! ");
15   result2=compress(substr(accountno2,1,8)||put((input(substr(accountno1,9,1),1.)-1),5.)||substr
15 ! (accountno1,10,7)||put((input(substr(accountno1,17,1),1.)+1),5.)||substr(accountno1,18,2),"
15 ! ");
16   result3=compress(substr(accountno3,1,8)||put((input(substr(accountno1,9,1),1.)-1),5.)||substr
16 ! (accountno1,10,7)||put((input(substr(accountno1,17,1),1.)+1),5.)||substr(accountno1,18,2),"
16 ! ");
17   run;

NOTE: Numeric values have been converted to character values at the places given by:
      (Line):(Column).
      14:25    14:60    14:95    14:131   14:167   15:25    15:60    15:95    15:131   15:167
      16:25    16:60    16:95    16:131   16:167
NOTE: Invalid third argument to function SUBSTR at line 14 column 88.
NOTE: Invalid second argument to function SUBSTR at line 14 column 124.
NOTE: Invalid second argument to function SUBSTR at line 14 column 160.
NOTE: Invalid third argument to function SUBSTR at line 15 column 88.
NOTE: Invalid second argument to function SUBSTR at line 15 column 124.
NOTE: Invalid second argument to function SUBSTR at line 15 column 160.
NOTE: Invalid third argument to function SUBSTR at line 16 column 88.
NOTE: Invalid second argument to function SUBSTR at line 16 column 124.
NOTE: Invalid second argument to function SUBSTR at line 16 column 160.
accountno1=1234567890 accountno2=123456789012 accountno3=1.2345679E13 result1=1234566890.
result2=123456786890. result3=1.2345676890. _ERROR_=1 _N_=1
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1 at 14:151   1 at 15:151   1 at 16:151
&lt;/PRE&gt;
The way you read the account variables was a numeric values. So when you drop them into a character function, such as SUBSTR, SAS does a conversion to character from number and may not use the character string you expect. There are also some possible side effects from using the || operator to concatenate things that often result in embedded blanks where you don't expect them.&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2022 05:45:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801226#M315307</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-03-10T05:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: ERRORS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801231#M315312</link>
      <description>&lt;P&gt;&lt;STRONG&gt;ALWAYS&lt;/STRONG&gt; post your log in a code box, like you did with your code.&amp;nbsp;&lt;STRONG&gt;ALWAYS.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2022 06:14:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801231#M315312</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-10T06:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: ERRORS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801232#M315313</link>
      <description>&lt;P&gt;Maxim1: Read the Documentation.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1lltvbis7ye1an1eryo4leh2mck.htm" target="_blank" rel="noopener"&gt;OUTPUT Statement&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2022 06:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801232#M315313</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-10T06:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: ERRORS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801259#M315332</link>
      <description>&lt;P&gt;I fixed the error and it runs but still&amp;nbsp; I cannot understand what it is trying to do with all the compress input put, also the 5. does not seem to be doing anything significant here&lt;/P&gt;
&lt;P&gt;I end up getting all three results with 10 digits&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2022 08:19:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801259#M315332</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-03-10T08:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: ERRORS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801267#M315335</link>
      <description>&lt;P&gt;We don't understand either. Using the&amp;nbsp;&lt;EM&gt;character&lt;/EM&gt; function SUBSTR on&amp;nbsp;&lt;EM&gt;numeric&lt;/EM&gt; values is simply a VERY BAD IDEA.&lt;/P&gt;
&lt;P&gt;Are you sure that the variable is numeric in your original dataset (use PROC CONTENTS)?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2022 09:40:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERRORS/m-p/801267#M315335</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-10T09:40:28Z</dc:date>
    </item>
  </channel>
</rss>

