<?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: Invalid numeric data during concatenation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-during-concatenation/m-p/440670#M110139</link>
    <description>&lt;P&gt;To concatenate them together requires only a single statement after the SET statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;newvar = catx(' ', var7, var8);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The program as it stands has several significant issues.&amp;nbsp; But the one causing the message you see is the creation of VAR.&amp;nbsp; What is VAR supposed to contain?&amp;nbsp; Is it actually supposed to be a variable?&amp;nbsp; It is mentioned on only one line of the program, and it is numeric.&amp;nbsp; So the assignment of characters to VAR is causing this message.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Feb 2018 21:41:49 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-02-27T21:41:49Z</dc:date>
    <item>
      <title>Invalid numeric data during concatenation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-during-concatenation/m-p/440668#M110137</link>
      <description>&lt;P&gt;I have two different character variables that are extracted from qualitative surveys (var7 and var8). I want to concatenate them together with a space in between. I wrote the cold below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA NIC.DICTATION2;&lt;BR /&gt; SET NIC.DICTATION;&lt;BR /&gt; ARRAY OLD {*} VAR7-VAR8;&lt;BR /&gt; ARRAY NEW {*} $2000 NEW7-NEW8;&lt;/P&gt;
&lt;P&gt;DO I=1 TO DIM(OLD);&lt;BR /&gt; NEW(I)=STRIP(PUT(OLD(I), $CHAR2000.));&lt;BR /&gt; VAR=(VAR||' '||NEW(I));&lt;BR /&gt; END;&lt;/P&gt;
&lt;P&gt;WHERE VAR7^="";&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I keep on getting an error:&amp;nbsp;NOTE: Invalid numeric data, ' wrist adduction' , at line 51 column 16.&lt;BR /&gt;NOTE: Invalid numeric data, ' abduction' , at line 51 column 16.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can some one help?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 21:28:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-during-concatenation/m-p/440668#M110137</guid>
      <dc:creator>lei</dc:creator>
      <dc:date>2018-02-27T21:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data during concatenation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-during-concatenation/m-p/440670#M110139</link>
      <description>&lt;P&gt;To concatenate them together requires only a single statement after the SET statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;newvar = catx(' ', var7, var8);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The program as it stands has several significant issues.&amp;nbsp; But the one causing the message you see is the creation of VAR.&amp;nbsp; What is VAR supposed to contain?&amp;nbsp; Is it actually supposed to be a variable?&amp;nbsp; It is mentioned on only one line of the program, and it is numeric.&amp;nbsp; So the assignment of characters to VAR is causing this message.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 21:41:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-during-concatenation/m-p/440670#M110139</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-27T21:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data during concatenation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-during-concatenation/m-p/440674#M110141</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try this, you are assigning character to numeric.&amp;nbsp; This fixes it. I took some values as an example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA x;&lt;BR /&gt;ARRAY OLD {*} VAR7-VAR8 (1,2);&lt;BR /&gt;ARRAY NEW {*} $2000 NEW7-NEW8 ('A','B');&lt;BR /&gt;DO I=1 TO DIM(OLD);&lt;BR /&gt;NEW(I)=STRIP(INPUT(OLD(I), $CHAR2000.));&lt;BR /&gt;VAR='VAR'!!' '!!NEW(I);&lt;BR /&gt;END;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc print data=x;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 21:48:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-during-concatenation/m-p/440674#M110141</guid>
      <dc:creator>yashk</dc:creator>
      <dc:date>2018-02-27T21:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data during concatenation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-during-concatenation/m-p/440835#M110210</link>
      <description>&lt;P&gt;Looks like you have some trouble with the way SAS handles character variables.&lt;/P&gt;&lt;P&gt;If I understand correctly you are trying to put the trimmed values of the old variables into the new variables. Which will not work, the STRIP and TRIM functions shorten their output, but when the variable values are put into the new variables, these are again padded to the right with blanks up to their length as declared (in this case 2000).&lt;/P&gt;&lt;P&gt;I think that what you want to do is something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA NIC.DICTATION2;
  SET NIC.DICTATION;
  WHERE VAR7^="";&lt;BR /&gt;  length var $200; /* or whatever length is enough */
  var=strip(var7)!!' '!!strip(var8);
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Which is much easier to do with the CATX function:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Nic.Dictation2;
  set Nic.Dictation;
  Where Var7 ^= ' ';
  var=catx(' ',of var7-var8);
run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The CATX function automatically assigns a length of 200 to the result, if the output variables is not previously declared. You can get another length by using a length statement first. As shown, you can use OF to use a list of variables as parameters (as you are using arrays, my guess is that you actually have more variables than two).&lt;/P&gt;&lt;P&gt;And you will get programs that are much easier to read if you stop putting everything in CAPS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 11:07:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-during-concatenation/m-p/440835#M110210</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2018-02-28T11:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid numeric data during concatenation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-during-concatenation/m-p/440975#M110256</link>
      <description>&lt;P&gt;Thank you it works!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 17:55:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-numeric-data-during-concatenation/m-p/440975#M110256</guid>
      <dc:creator>lei</dc:creator>
      <dc:date>2018-02-28T17:55:14Z</dc:date>
    </item>
  </channel>
</rss>

