<?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 Concatenation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/282842#M57537</link>
    <description>&lt;P&gt;A="FA";&lt;/P&gt;&lt;P&gt;B="1";&lt;/P&gt;&lt;P&gt;AB=AB||B;&lt;/P&gt;&lt;P&gt;BA=B||BA;&lt;/P&gt;&lt;P&gt;rub;&lt;/P&gt;&lt;P&gt;For BA the value is coming as . 1 but for AB it is coming as &amp;nbsp;.??It should be same for AB as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jul 2016 00:33:44 GMT</pubDate>
    <dc:creator>pawandh</dc:creator>
    <dc:date>2016-07-08T00:33:44Z</dc:date>
    <item>
      <title>Concatenation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/282842#M57537</link>
      <description>&lt;P&gt;A="FA";&lt;/P&gt;&lt;P&gt;B="1";&lt;/P&gt;&lt;P&gt;AB=AB||B;&lt;/P&gt;&lt;P&gt;BA=B||BA;&lt;/P&gt;&lt;P&gt;rub;&lt;/P&gt;&lt;P&gt;For BA the value is coming as . 1 but for AB it is coming as &amp;nbsp;.??It should be same for AB as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 00:33:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/282842#M57537</guid>
      <dc:creator>pawandh</dc:creator>
      <dc:date>2016-07-08T00:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/282843#M57538</link>
      <description>&lt;P&gt;I have no idea what you're trying to do, but you're referencing variables that don't exist: &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AB=AB||B &amp;nbsp; - &amp;nbsp;the program doesn't know what AB is?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So since you set B as a '1' but then never told it what AB was supposed to be, it automatically converts your number into a numeric 1 and then it results in a NOTE: in your log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next, you do something similar with B||BA, except B actually exists (but as a string) - so it concatenates as &lt;BR /&gt;&lt;BR /&gt;'1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.' &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, check your log. The answer is often there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since i dont know what you're doing, I cant help very much from here. But my big tips are:&lt;/P&gt;
&lt;P&gt;(1) use length and input statements to correctly define the variable you're adding to avoid surprises&lt;/P&gt;
&lt;P&gt;(2) check &amp;nbsp;your log often... even when you think things went correctly&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 00:56:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/282843#M57538</guid>
      <dc:creator>JBerry</dc:creator>
      <dc:date>2016-07-08T00:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/282848#M57541</link>
      <description>&lt;P&gt;Use the CAT/T/X/S/Q family of functions instead. It's better at handling missing values, if that's what you're after.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 02:22:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/282848#M57541</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-08T02:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/282849#M57542</link>
      <description>&lt;P&gt;+1 for the cat functions.&lt;/P&gt;
&lt;P&gt;The concatenate operator || doesn't trim spaces, and I suspects that's why you don't get the expected result, since the&amp;nbsp;second variable in the || operation will be pushed at the very end of the first one.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 02:32:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/282849#M57542</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-07-08T02:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/282850#M57543</link>
      <description>&lt;PRE&gt;1    data test;
2    A="FA";
3    B="1";
4    AB=AB||B;
5    BA=B||BA;
6    run;

NOTE: Numeric values have been converted to character
      values at the places given by: (Line):(Column).
      4:4   5:7
NOTE: Character values have been converted to numeric
      values at the places given by: (Line):(Column).
      4:6   5:5
NOTE: Invalid numeric data, '1           .' , at line 5 column 5.
A=FA B=1 AB=0.1 BA=. _ERROR_=1 _N_=1
NOTE: The data set WORK.TEST has 1 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.89 seconds
      cpu time            0.07 seconds
&lt;/PRE&gt;
&lt;P&gt;My interpretation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On line 4, SAS will set the type of new variable AB to the type of the expression on the right of the assignment.&lt;/P&gt;
&lt;P&gt;Checking that expression, it meets the still untyped variable AB which this time gets the default type: numeric&lt;/P&gt;
&lt;P&gt;and initial value: missing.&amp;nbsp;Once set, the type of a variable cannot change.&lt;/P&gt;
&lt;P&gt;Concatenation of AB and B thus requires the conversion of numeric AB to a string. The default format (BEST12.) is used and yields&lt;/P&gt;
&lt;P&gt;' &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .' (11 spaces and a period) . The concatenation result is ' &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .1' which is then assigned to AB (now typed), after conversion to numeric: 0.1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The same line of reasoning on line 5 yields the string '1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .' as the result of concatenation, which cannot be converted to&lt;/P&gt;
&lt;P&gt;numeric and thus generates&amp;nbsp;an &lt;EM&gt;Invalid numeric data&lt;/EM&gt; note and a missing value for BA.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The apparent lack of symmetry between the two results comes from the fact that " &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .1" can be converted to numeric&lt;/P&gt;
&lt;P&gt;but "1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ." can't.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 02:36:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/282850#M57543</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-07-08T02:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/282869#M57554</link>
      <description>&lt;P&gt;I am just checking how it works.I got for AB||B -here my AB is missing n if i concatenate it with B then first B which is a character will be converted to numeric(best 12 format) so i will get &amp;nbsp;". 1";&lt;/P&gt;&lt;P&gt;But i don't understand how it works for B||AB .I got that it would be "1 &amp;nbsp; ." ,but in my output it is a missing value?&lt;/P&gt;&lt;P&gt;can u explain why?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 06:33:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/282869#M57554</guid>
      <dc:creator>pawandh</dc:creator>
      <dc:date>2016-07-08T06:33:04Z</dc:date>
    </item>
  </channel>
</rss>

